I think you need to be a little more specific in what you want to do.
Generating a list from what?
Is there some path to where the files are?
Should the file list be stored in a .csv and a .dat? And if so, in which format should this be saved? (csv is obvious, just comma-seperated. But the .dat file?)
Just write down the scenario of what you want to do and be a little more precise in your description of it
I'll write some quickie-code to show you how this might be done.
for i in /tmp/*; do
echo "$i," >> $csv_out
echo "$i," >> $dat_out
This will delete all files in the folder /tmp and also write 2 files, file.csv and file.dat containing the files seperated by a comma