reads contents of a file, line by line