I want to print to the output file and not the input file. The years do print to the file but not in the positions that I want them to. What I want is: Year\tAge\tNumber_of_males\tNumber_of_females. And this form needs to print on multiple lines. Sorry I should have mentioned that earlier.