I think I read your question and get confused with cp and scp.
Make me correct if I am wrong somewhere
* you can not run cp command in server because of sudo restriction
* you can only do scp to remote machine from your system
So I am pointing the below method on scp command only.
Remote File name = remotetest.txt
Local File name - localtest.txt
Remote Machine Name = ServerA
Your machine name = laptop
Now you are here only using your laptop .And will do scp only from your laptop , not from inside of the server
Method (1) ;Login in your laptop (I hope it is linux machine)
to scp a file from your laptop to remote server
scp localtest.txt username@serverA:/path/in/server
scp localtest.txt user1@ServerA:/opt/
Method (2) Second method you already typed. That was getting file from remote server to your laptop