If you want to print the prompt and assign a new value to dns you had better put code to do that inside the loop. Otherwise the prompt only gets printed once, and dns never changes its value.

---...