function to read all lines of a file