Save outcome to CSV file, multiple datasets

For my research I want to extract the features of 40 different VOIs. Most ideally, I would like to save the outcome of the features automatically into a csv file. For 1 VOI this is no problem. But my question is, is it possible to save the new outcome to the same csv file everytime the code is runned?
So that I only have to change the name of the VOI, run the code 40 times and end up with 1 csv file with all the outcomes?

Thank you!

You can automate all the steps that you do in the Slicer GUI using Python scripting. The Slicer Script Repository and Developer Tutorials page are good starting points.