Saving run time session values and using them in another scenario

Hello Team,

My code is creating test plan/cycle and extracting the cycle id [Here i am creating around 100 test plans]
I could successfully write them in a csv file, however the recently created Cycle IDs are not getting used instead the cycle IDs created in previous simulation execution are getting used in next scenario.

e.g Simulation Run1 - I have created 5 test cycles say [100, 101, 102, 103, 104]
Simulation Run2 - I have created 5 test cycles say [105, 106, 107, 108, 109]

Now i am executing next scenario’s, ideally cycle IDs 105 to 109 must get used for next operations but i could see cycle IDs 100 to 104 are getting used.
Note: I have used flush() to clear the existing data from the file.

Kindly help me in getting it sorted.
I want to know from where the 2nd simulation getting cycle IDs which have been actually created during Simulation Run1

Also if i delete cycle IDs 100 till 104 then error is getting received as “Cycle does not exist”

I don’t know why it is not taking reference of current extracted data.

Your help would be much appreciated.

Thanks in advance…!!

This seems to be an issue with the flat files as they are not holding the newly written data for next execution.