The correct way to do this would be to read the entire data, do the modifications in the variable and then overwrite the file with new data.
Use Read from CSV file to read it. Enable the toggle to retrieve first row as headers. You'll end up with a data table in %CSVTable%. You can then use %CSVTable.Colums% to get the column names into a list. You can use Replace text on it to replace values as needed. But this will convert the list into a string. So, you'll need to use Split text on it afterwards to split it into a list again.
Finally, write the resulting list into a new CSV file via Write to CSV file. Then, after you've done that, write the entire %CSVTable% in it, appending the values. When you write a data table and make it not include header row, it will only write the data. So, the headers you wrote previously will not be overwritten.
You can then move/rename this file to the location of the original file to replace it. Or you could just make the initial Write to CSV file action (that writes the headers) overwrite the original data.
-------------------------------------------------------------------------
If I have answered your question, please mark it as the preferred solution. If you like my response, please give it a Thumbs Up.
I also provide paid consultancy and development services using Power Automate. If you're interested, DM me and we can discuss it.