Export the robot's TCP coordinate data to a CSV file

I would like to export the robot’s TCP coordinate data to a CSV file.
I want to collect TCP coordinate data at 0.04-second intervals while the robot is moving and save it as a CSV file.
I have written the code so far using other references, but I am not sure where to modify it.
Could anyone help me with this?

Thank you.

[24.09.23] csv tcp coordinate.vcmx (122.7 KB)

Is there any reason you want the robot simulation’s TCP coordinate data?

You want to use it as training data for your data analysis model.
Can you help me?