How to get the last counter value from txt file from SD card

If the last value has to be a 0 because you need it to find the second last,
writing a new second last needs another 0, don't you think so?

You were not able make the positioning work on read, so I doubt you will use it on write.

Example:
....
'5545,'
'0,'

  • new value (5654) via appending
    ....
    '5545,'
    '0,'
    '5644,'
    '0,'

wasting a lot of space (about same as used).