getting error "ssh-copy-id: not found"

Hello, i am trying to make an ssh connection from one server to another and invoke a script on another server.

while doing this i want to do a passwordless ssh connection for the same, for which i have used the following command

ssh-keygen -t rsa
ssh-copy-id -i $remoteuser@$remotehost>>output.txt

But is giving an error ssh-copy-id: not found when i am running the script with the above commands. Pls help me out in this!

I do not know where you got ssh-copy-id from. So, lets do some reading:

Please read and go through the following steps:

ssh-keygen: password-less SSH login

ssh-copy-id is a small utility bundled with many Linux distros to make copying public keys to the correct place much easier.

ssh-copy-id(1) - Linux man page

Yes, but the OP probably is does not have it, but has ssh installed because ssh-keygen worked okay. On questions out of the blue the best answer is always one that will work anywhere.

Otherwise you get into 20 questions mode, and have to rule out a large array of possibilities.