Implement output to csv file in the CLI