int SaveStringToFile(str Filename, str S, int? Append, int? UTF8)
Saves the specified string to the specified file. If Append is non-zero or ommitted and the specified file already exists, it will be appended to instead of overwritten. If UTF8 is non-zero or ommitted, the string will be saved with UTF8 encoding instead of ASCII encoding. Returns non-zero if successful, or zero otherwise.
This function does not automatically write a line break before or after the string. If Append is non-zero or ommitted and the existing file did not end in a line break, the function will effectively append to the existing last line. To avoid this you can put line break characters (using NewLine) before and/or after your string.
#expr SaveStringToFile('c:\filename.txt', NewLine + 'the string' + NewLine)