I want to scp file from one server to another, both server have different user name and

i want to scp file from one server to another. both server have different user name and it needs to give password to transfer file.how can we mention password in the script itself so that we need not mention password while running the script.
Say from servers cpli with user abc and file path /opt i want to transfer file to server cper with user xyz to path /tmp

You don't.

scp is designed to prevent you from injecting passwords in this manner, because it is an extremely bad idea.

Any other sane authentication method also rejects injected passwords the same way -- including su and sudo.

If you want to connect passwordlessly, use ssh keys.

what other possible way can be possible to do this

Try ssh keys. SSH login without password

Any other option other than this possible here

Not any good ones. All other options involve installing third-party utilities and opening up massive security holes.

Why can't you use keys? That's what they're there for.

Is there any possibility of Invoke user input

Like,using expect script interactive

expect script.sh user passwd

cat script.sh

#!/usr/bin/expect
scp ~/text.txt $1@IP: ~/
expect "?asswd:\r"
send "$2\r"
interact

The reason you need to use the expect brute-forcing utility to brute force a password into it is because it is specifically designed to prevent you inputting passwords, to the point you have to use a third-party brute forcing utility to do so.

Force-feeding it stored passwords inevitably opens massive security holes.