I suspect you took that statement literally and put the code at the very bottom of functions.php, after the PHP closing (?>) tag instead of immediately before. Anything outside of PHP opening/closing tags is displayed verbatim.

Alternatively, you can simply omit/remove that bottom closing tag from functions.php, as it is optional per the official PHP documentation. Removing it will allow your functions.php to be truly appendable, and you won't have to worry about inadvertently displaying code instead of running it.