Kindly check the below code:
f = open( ... )
line = f.readline() # no 's' at the end of `readline()`
last_pos = f.tell()
simply recall, last_pos isn't a line number in your document, it's a byte offset from the start of the file - there's no reason for incrementing/decrementing it.
Interested to learn python in detail? Come and Join the python course.