Fixing the test to write to a csv file not to a txt file