Servo Jerk

The project we're currently doing for class is requiring us to use a few servo motors to create an animatronics bat. However I am having coding problems with the servo's. They simply work fine, it will go from one degree to the next, but when it resets to it's original position and goes the other way it seems to jerk real fast and does not look smooth at all.

Any help on how to fix this would be helpful!

Here is my code, it is similar to the one on the arduino reference website, I've just added in a few extra lines.

#include <Servo.h> 
 
Servo myservoA;
Servo myservoB;

int pos = 0;    // variable to store the servo position 
 
void setup() 
{ 
  myservoA.attach(9);  
  myservoB.attach(8);
} 
 
 
void loop() 
{ 
  for(pos = 50; pos < 1; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservoA.write(pos);              // tell servo to go to position in variable 'pos' 
    (15);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 140; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservoA.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);                       // waits 15ms for the servo to reach the position 
  } 
  { 
  for(pos = 90; pos < 50; pos += 1)  // goes from 0 degrees to 180 degrees 
  {                                  // in steps of 1 degree 
    myservoB.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(10);                       // waits 15ms for the servo to reach the position 
  } 
  for(pos = 0; pos>=1; pos-=1)     // goes from 180 degrees to 0 degrees 
  {                                
    myservoB.write(pos);              // tell servo to go to position in variable 'pos' 
    delay(15);    
  }    
  } 
}

Maybe you need a few more useless curly braces in the code.

Or, more likely, you need to tell us how the servos are powered and what load is being applied to the servos.

for(pos = 50; pos < 1; pos += 1)  // goes from 0 degrees to 180 degrees Why bother with comments?

The start position for each loop is not the same as the end position from the previous loop, so the servo jumps to the start position as fast as it can. If you want a smooth continuous motion, you need to make sure that you don't make any abrupt changes to the servo position. (If the code actually did what the comments implied, you wouldn't have this problem.)