Write the writeToFile method for the storage class.