Call contractUpdate at any bar in the backtest, then the contract function to find the at the money contracts.

There are some script examples for options trading.

For exporting data to csv you can use print(TO_CSV,...) or dataSaveCSV.