Many hands make light work.
The first line writes "hello world" to the file "output", the second reads it back and writes it to standard output (normally the terminal). A "here" document is essentially a temporary, nameless file ...
Recently I needed to create a script that processed two input files. By processed I mean that the script needed to get a line from one file, then get a line from the second file, and then do something ...