$ ls
dofile.php
$ php dofile.php
$ ls
dofile.php filename.txt
$ cat filename.txt
hello, there
$
I called my php file "dofile.php". I added a "newline" character to the end of the string, so that after you type "cat filename.txt", the prompt appears at the beginning of the next line. Try it both ways - with the newline \n and without it.
(P.S. If that answers your question, please click the Edit link at the bottom of your original post at the top of this thread. Change the Title prefix to "Solved".)