sftp using password not working in unix

Sorry to post this thread as it has been asked several times. But my question is that I need to write a shell script to transfer a file from machine A to machine B using sftp. I generated pvt-pub key pair and put pub key in machine b and lso make the pub file's permision 600. .ssh directory permission 700 in machine B. but still it is asking for password. Can we use sftp like ftp mentioning user name and password in the same shell script?Please let me know if it sftp is possible using password.

You are best of trying to get passwordless login working. How did you put the pub key machine b, did you use ssh-copy-id?

Here is quite a good mini-howto on passwordless ssh: Password-less logins with OpenSSH try working thru it.