It is a bit tricky one which involves directly messing up with the shadow file.
what needs to be done is, after the creation of an ID using useradd command, to place the encrypted passwd in the password field in the row for the ID in shadow file.
This is more safe, we need to work with spawn and expect to place the password for the ID which has been created.
It is not possible to directly set a specific password for a unix account with standard unix commands.
Your earlier posts suggest that you may know the correct value for the password "salt" without stating that value. Afaik the "crypt" program has nothing to do with passwords. Afaikn you would need knowledge of the correct "salt" value and a custom "C" language program to produce a valid encrypted password and then (as "vishalaswani" notes) some skilled editing to modify the shadow file.
I have a "C" program to set a unix password to a given value but there is no way that I would publish such a program on the Internet.
As "dangral" suggests, consider using the "passwd" command.