ls > textfile.txt
This is a simple way to get a list of files in a certain folder and rather than write them to the screen it writes them to a text file that could be used in another script perhaps.
The above command will create a simple list of the file names in a particular directory.
If would like more details on the files you can use
ls -l > textfile.txt
Added the "-l" (the lowercase letter L) will produce a "long" list with the file details.
This could be used to create a spreadsheet where you could sort or filter the files for some other purpose.