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 ...
If you've used the command line much at all you know about I/O redirection for redirecting input to and/or output from a program. What you don't see all that often or that you may not be familiar with ...