you would want a while loop. this page looks like it will be a good reference:
http://tldp.org/LDP/Bash-Beginners-G...ect_09_02.html
ie, you will loop "while" your input variable is not equal to "4" (or whatever your exit input number corresponds to)
by the way, it is good that you included your code in your post (however even better if you use the CODE tags!). if you had not (and had not specified which scripting language, or even compiled language ie C for that matter), then your first response you would get would likely be "what language". the reason for this is that there are hundreds (if not thousands) of programming languages, and all support different constructs (ie while loop) and will have different syntax.