Open Terminal with Spotlight, or by navigating to the Utilities | Applications folder and clicking Terminal.app
Once Terminal is open, navigate to the location where the file is to be created. If you want to know your present location type the pwd command.
cd Desktop/
Create file with the touch command.
touch script.command
If you try to run the created script it will fail due inappropriate access privilages.
Use the chmod command to apply the appropriate access privilages.
chmod +x script.command
Use TextEdit to add the required commands to the file.
NOTE: If you need to run a command that requires root access, add the sudo prefix your command. When the script runs you’ll be requested to enter your admin password.