How can I record 4 different variables values in to a cvs file in different columns, one row every cicle is completed?

How can I record 4 different variables values in to a cvs file in different columns, one row every cicle is completed?

Copy variables to general purpose registers in every cycle (possibly in separate thread), and use RTDE to extract them to CSV file.
There is a python example for saving RTDE data to csv file on support site.