The logic to your code is there. You just don't seem to be looking up the syntax or the definitions in the Scripting Index.
If( File Exists(location)
you are missing a comma and/or a completion
If( File Exists(location),
or
If( File Exists(location) == 1,
I don't understand the logic of the next line
csvlist[N Items(FilesIndex)]= Open(location),
the way it is written, the pointer to every data table would be written on top of each other, unless somewhere in your code FilesIndex is getting added to between openning data tables. I suggest an easier, safer method
dt = Open(location);
insert into(csvlist,dt),
there is no need for "continue", the code will contine automatically
Your "Save Text File" function is syntactically fine, if you want the each execution to write over the previous execution of the line. Take a look in the Scripting Index to see how to keep from doing that if you want to add to the file rather than writing on top of it.
I would also suggest that if you want the error lines to be added to the code, that you add "\!n" to each line, to force each listing to a new line.
Jim