I’m new. Please help me with this coding

In this code the servo is rotated once by detecting any object by ultrasonic. and I want to rotate the servo from max to max time once detected through ultrasonic.

you should not copying your text but writing new, it could happen you write it different and does not same error.
do you mean, servo should rotating for ever after he start?

@luckysahil I note with disappointment that when you posted your code you did not use code tags as requested

That is very bad manners. Do not do it again

Nicely put.
There are some very bad mannered people posting recently and that was compartitively mild to some I have seen.