Making a Servo spin for set amount of time

so how should i try and fix the code?