Use file.position() to get the (unsigned long) file position before writing a new line.
Use file.seek(position) to set the file pointer back to the beginning of the known line.
As PaulS recommended: Keep a circular buffer of the last 20 file positions so you can read the last 20 lines in any order.
Note: if you want to read a line that is NOT at the end of the file and then add more lines to the end, be sure to note the end-of-file position before you read and seek that position before you write more.