I will have a program which will save the equipments into the text file and I have a button which increases the number of the equipment. That button works now, but I want the program to save the new number. For example,
First,

Resistors 15
Control cards 22

I increased the the number of resistors. It's 16 now. I want to save it after deleting the old data

Then,
It should be

Resistors 16
Control cards 22


when I try to do this, it will be

Resistors 15
Control cards 22
Resistors 16


How can I solve this problem?

Thanks