Normally I suffix script files with .sh extension and run them with the "source" command something like the following:
$ chmod +x my-script.sh
$ source my-script.sh
Wheras in your case the script file will be something like the following:
sudo ntpdate ntp.ubuntu.com pool.ntp.org < helloworld
-- end of script
Not 100% sure that < will work for a password prompt.
Generally it is considered a bad idea to put passwords inside scripts. I guess it depends on how much your system would be compromised if the password was discovered by a hacker. I don't know much about ntpdate but maybe add that command into the /etc/sudoers config file allowing you to run that command without a password.