Added code to write bins to output file (still need code to write the averages in Measure class)