appendToTextFile (function) - should merge with appendToFile