Move generating a File's lines into a function