Add Function to write a file

- create a file and write the result to it