generalized the fitness history saving to csv