Save list of files to text file
You're getting the No such file or directory
error most likely because the directory you're trying to create the file in doesn't exist.
Create the directory first using:
mkdir -p /root/test1/test2
And then try again.
root@rubiks:~# mkdir -p /root/test1/test2
root@rubiks:~# ls /bin >/root/test1/test2/filelist.txt
root@rubiks:~# head /root/test1/test2/filelist.txt
GET
HEAD
NF
POST
VGAuthService
X
X11
Xephyr
Xorg
Xwayland
As stated in the comments, there is the assumption that:
Nothing inside /home/kali/Desktop/test1/test2. I have been told this path equals /root/test1/test
Unless you have created a symlink (which I highly doubt), this assertion is wrong. Paths are unique on Unix based systems and the first path is not the other.
Given the nature of your question and your own assertion that you don't "understand Linux", I'm also slightly wondering why you're using Kali Linux. As Kali's developers state:
The fact of the matter is, however, that Kali is a Linux distribution specifically geared towards professional penetration testers and security specialists, and given its unique nature, it is NOT a recommended distribution if you’re unfamiliar with Linux or are looking for a general-purpose Linux desktop distribution for development, web design, gaming, etc.
This is good advice. Kali Linux is not for the faint of heart, it's a very specific distro with a very specific use case and things that are easy in Ubuntu, Fedora or Mint are a major hassle on Kali. You might want to get some experience using Linux based systems on a distro that's easier to use (the aforementioned).