Hi there,
If I am getting it correctly what you are looking for is to ssh a machine, create tar.gz file there and send it back to original machine over ssh. Is that correct? If that is the case I would suggest you to use scp as follows:
tar -cvf testing.tar.gz testing && scp -vrp /root/testing.tar.gz
root@xxx.xxx.xxx.xxx:/root/
Command before && will create a tar and scp will copy it over to the machine from where you have ssh to this machine.
where for tar:
c=create
v=verbose
f=file_name
Where for scp:
v=verbose
r=recursively
p=preserve permissions
xxx=ip address of the destination server dont forget the : after that