Automatic macro script not saving csv file

Hi everyone,
I would like to automate plot over line filter on different cases (with different mesh). I started “start trace” and recorded the actions as a macro script. I have three test cases. I could get csv file in only one of the three folders but not in all with pvbatch command.

Could anyone please let me know why this script is not saving csv file in all folders. ?

Thank you very much

new2.py (12.6 KB)

Sorry, I made a basic mistake since I don’t have experience in python. I missed indentation for the content of for loop.