Problem with while statement.

Hi, I have a physics based educational game that I am working on and I have a problem.
I have a catapult that I should be able to move with the left and right arrow keys. Originally the player would have to keep pressing the keys in order to get it to continue moving but I have decided that for this, a while statement would be better than my original if.
the problem was that as it is an update function, the while statement would push the catapult as far as it would allow in its conditions within a single frame.
I wanted my catapult to move in increments when the keys are held.
I decided to add a timer to split this up but it seemed ineffective.

here is my code:

var delayCount : float = 5.0f;

function Update()
{

 
delayCount -= Time.deltaTime;
	if (delayCount<0) 
 	{  

	gameObject.tag == "catapult main";

		while(Input.GetKeyDown ("left") && gameObject.transform.position.x > -10)
			{
			gameObject.transform.position.x -= 1;
			}
		while(Input.GetKeyDown ("right") && gameObject.transform.position.x < 10)
			{
			gameObject.transform.position.x += 0.001;
			}
		delayCount = 5.0f;
	}

}

You should not use while or for loops inside Update unless they are limited counting loops (loop for 5 times, for instance), because they will lock your game until the condition is satisfied. You could move smoothly using this:

var speed : float = 5.0f; // meters per second

function Update()
{
  // why are you changing the tag inside Update?
  gameObject.tag == "catapult main";
  // move this object at constant velocity = speed:
  if (Input.GetKey ("left") && transform.position.x > -10){
    transform.position.x -= speed * Time.deltaTime;
  }
  if (Input.GetKey ("right") && transform.position.x < 10){
    transform.position.x += speed * Time.deltaTime;
  }
}