c # – Update app.config or web.config via code

I develop a flight that reads all the lines of several files contained in a folder. But I have to know what was the last file and the last line read to be able to resume them if necessary.

I thought of putting it in the database, but thinking that I would have +10 million lines, it would not be nice to update all the time. I therefore had the idea of ​​inserting it into my configuration file.


However, given this approach, these values ​​should be updated, the question is:

Looking semantically, is it wrong to use this approach? And how would I update the value of this key directly in web.config or app.config?