trouble making a useradd script

i'm new to scripting in unix and am trying to make a script to add a user and an encrypted password for them. this is what i have and it isn't giving me any errors, but when i try to login with the new user, the password doesn't work. i'm hoping someone can point me in the right direction

#!/bin/sh
echo Enter First and Last name:
read fullname
echo Enter Username:
read username
echo Enter Password:
read password

sudo useradd -c "$fullname" -m -s "/bin/bash" -p `makepasswd --string "$password" --crypt-md5 | awk -F$ '{print "$" $2 "$" $3 "$" $4}'` "$username"

I don't have the command makepasswd on my system, could you please run below command, and paste the output here?

makepasswd --string "testonly" --crypt-md5

And can you use the full path for command useradd, makepasswd and awk in sudo command.