OK. I don't like to give homework answers directly, but I'm happy to point you in the right direction. There's some terminology you'll need to know to find the info.
Commands which print output can have that output
redirected to a file. This is done by the shell (the program which runs inside a terminal window - it read commands, execute them and prints their output). The shell on most Linux systems is called
bash. If you look up the bash documentation and search for redirection, that should tell you how to do it.
After that it's just a matter of finding the right command. You can use several for this purpose.
ls is probably the one you want. To work out how to list a specific directory's contents, see the documentation
Most Linux systems ship with documentation for both these things in the system manual. To access the system manual, you can type in "man
subject" in a terminal window. You can use space to page down, up and down cursors to move a little bit, / to serach, and q to quit.
So to see the manual page for bash, type "man bash", and likewise "man ls" for the ls documentation.