Servo motor not working as expected in elseif statement

The image in this post may help: