Trying to sweep a servo 10 times but my loop isn't working?

  if(Serial.available()){
    for (i = 0; i < 11; i++){
      for(pos = 20; pos <= 120; pos += 1){
        myservo.write(pos);
        delay(15);
      }
      for(pos = 120; pos >= 20; pos -= 1){
        myservo.write(pos);
        delay(15);
      }
    }
  }

Once the serial data arrives, you never bother to read it. Why not.

The if statement is not going to wait for serial data to arrive.