No need to store it anywhere. Just output the content with the appropriate content type.
<?php
header('Content-type: text/plain');
?>Hello, world.
Add content-disposition if you wish to trigger a download prompt.
header('Content-Disposition: attachment; filename="default-filename.txt"');