Creating a function to read from a file line by line