Read and edit a text file (Editor)

To read a table I can just use loadStrings without any problems, but the problem I am having now is instead of editing the specific file I need to make a new txt-file that can replace the old one with the text i want.
Thank you for the previous answers