You have working code. Print it out. Now, delete it. Rewrite from scratch, keeping in mind your old requirements AND your new requirements.
For one thing, if the servo is to keep moving back and forth, on each pass through loop, you must determine if it is time to move the servo, and, if so, to where.
The blink without delay example will show you the "is it time to do something" part.
There is no easy way to modify your existing code to incorporate your new requirements.