Gravity: A function that writes a array list to a csv file