Added a writeToFile function to the FileLoader