Calculating average score in the end and print to the csv file