writeResults function

Save the results