Shell scripts are contained in text files... You don't type them on the command-line directly. Open a text editor and go to town...
The first time you try to run the script, save it, and at a command-line type:
chmod u+x filename
That will make the file executable. Then type:
That will run the script. The ./ at the beginning is to make sure the script in the current directory is run.
The "#!/bin/bash" line should be the first line in your script, and it tells the system that you want bash to interpret the commands in the file.