Read file line by line function.