how can I paste copied-clipboard text to a file from terminal?

Using xclip.
For writing clipboard to file, overriding existing content:

xclip -o > /path/to/file.txt

or for appending clipboard to file:

xclip -o >> /path/to/file.txt

If you don't want (or you can't) install extra software, you can do it with cat

cat > /path/to/file.txt

after this the terminal waits user input, so you can paste from your clipboard:

Ctrl + Shift + v

Then press Enter

And exit cat with Ctrl + c

I learned this while watching:
https://www.youtube.com/watch?v=dDddKmdLEdg