How to control servo motor via user serial monitor analog input?

I put this code inside my already exisiting code and when I enter in a number, ie. 0, it automatically goes to 180 degrees. It does this for any number I input. And also, it only reads an input once, I can't enter another number in and make it move again.

Then I would suspect something incompatable with your existing code.