Prior to v14, an approach to writing to a file would be to use the SEND PACKET command from the DocRef created by OPEN DOCUMENT, CREATE DOCUMENT, or APPEND DOCUMENT. To ensure that the data is saved to the disk, CLOSE DOCUMENT must be called.
In v14, the command TEXT TO DOCUMENT allows writing text directly to the disk. By using the CREATE DOCUMENT and CLOSE DOCUMENT, the file is created on the disk. Using TEXT TO DOCUMENT does not use the DocRef to write to the document but directly to the text file name. Also, data being written to the file has an option to use different modes of line breaks.