Writing the results to a file