loop text sent from seral monitor

Hi all... I'm trying to send some text through the serial monitor. The device translates text to morse code. I want the text that is written in the serial monitor to be repeated a certain amount of times, but I can't figure out how to loop it so that the text is sent to the board repeatedly.

This is the code:

int motorPin1 = 2;
int motorPin2 = 3;
int motorPin3 = 4;
int motorPin4 = 5;
int motorPin5 = 6;
int motorPin6 = 7;

int lettersPerSecond = 3;
int dataloop = 10;

void setup() 
{
  Serial.begin(9600);
  pinMode(motorPin1, OUTPUT);
  pinMode(motorPin2, OUTPUT);
  pinMode(motorPin3, OUTPUT);
  pinMode(motorPin4, OUTPUT);
  pinMode(motorPin5, OUTPUT);
  pinMode(motorPin6, OUTPUT);
}

void loop() 
{
  {
    if (Serial.available()>0)
    {
      char incomingByte = Serial.read();
      switch (incomingByte)
      {
        case '0': motorValue(2,2,2,2,2,2); break;
        case '1': motorValue(1,2,2,2,2,0); break;
        case '2': motorValue(1,1,2,2,2,0); break;
        case '3': motorValue(1,1,1,2,2,0); break;
        case '4': motorValue(1,1,1,1,2,0); break;
        case '5': motorValue(1,1,1,1,1,0); break;
        case '6': motorValue(2,1,1,1,1,0); break;
        case '7': motorValue(2,2,1,1,1,0); break;
        case '8': motorValue(2,2,2,1,1,0); break;
        case '9': motorValue(2,2,2,2,1,0); break;
        case '.': motorValue(1,2,1,2,1,2); break;
        case '/': motorValue(2,1,1,2,1,0); break;
        case '@': motorValue(1,2,2,1,2,1); break;
        case ',': motorValue(2,2,1,1,2,2); break;
        case '?': motorValue(1,1,2,2,1,1); break;
        case 'a': motorValue(1,0,0,0,0,0); break;
        case 'b': motorValue(1,0,1,0,0,0); break;
        case 'c': motorValue(1,1,0,0,0,0); break;
        case 'd': motorValue(1,1,0,1,0,0); break;
        case 'e': motorValue(1,0,0,1,0,0); break;
        case 'f': motorValue(1,1,1,0,0,0); break;
        case 'g': motorValue(1,1,1,1,0,0); break;
        case 'h': motorValue(1,0,1,1,0,0); break;
        case 'i': motorValue(0,1,1,0,0,0); break;
        case 'j': motorValue(0,1,1,1,0,0); break;
        case 'k': motorValue(1,0,0,0,1,0); break;
        case 'l': motorValue(1,0,1,0,1,0); break;
        case 'm': motorValue(1,1,0,0,1,0); break;
        case 'n': motorValue(1,1,0,1,1,0); break;
        case 'o': motorValue(1,0,0,1,1,0); break;
        case 'p': motorValue(1,1,1,0,1,0); break;
        case 'q': motorValue(1,1,1,1,1,0); break;
        case 'r': motorValue(1,0,1,1,1,0); break;
        case 's': motorValue(0,1,1,0,1,0); break;
        case 't': motorValue(0,1,1,1,1,0); break;
        case 'u': motorValue(1,0,0,0,1,1); break;
        case 'v': motorValue(1,0,1,0,1,1); break;
        case 'w': motorValue(0,1,1,1,0,1); break;
        case 'x': motorValue(1,1,0,0,1,1); break;
        case 'y': motorValue(1,1,0,1,1,1); break;
        case 'z': motorValue(1,0,0,1,1,1); break;
        case ' ': motorValue(0,0,0,0,0,0); break;
      }
    } 
  }
}

void motorValue(int length1,int length2,int length3,int length4,int length5,int length6)
{
 //This will turn on all long or short motor runs
  if(length1 != 0) {digitalWrite(motorPin1, HIGH);}
  if(length2 != 0) {digitalWrite(motorPin2, HIGH);}
  if(length3 != 0) {digitalWrite(motorPin3, HIGH);}
  if(length4 != 0) {digitalWrite(motorPin4, HIGH);}
  if(length5 != 0) {digitalWrite(motorPin5, HIGH);}
  if(length6 != 0) {digitalWrite(motorPin6, HIGH);}
  delay(1000/(lettersPerSecond*2));
  
 //This will turn off all short motor runs
  if(length1 == 1) {digitalWrite(motorPin1, LOW);}
  if(length2 == 1) {digitalWrite(motorPin2, LOW);}
  if(length3 == 1) {digitalWrite(motorPin3, LOW);}
  if(length4 == 1) {digitalWrite(motorPin4, LOW);}
  if(length5 == 1) {digitalWrite(motorPin5, LOW);}
  if(length6 == 1) {digitalWrite(motorPin6, LOW);}
 //Only pause if there is a motor going
  if(length1 == 2 | length2 == 2 | length3 == 2 | length4 == 2 | length5 == 2 | length6 == 2)
    {delay(1000/(lettersPerSecond*2));}

 //This resets all the motors
  digitalWrite(motorPin1, LOW);
  digitalWrite(motorPin2, LOW);
  digitalWrite(motorPin3, LOW);
  digitalWrite(motorPin4, LOW);
  digitalWrite(motorPin5, LOW);
  digitalWrite(motorPin6, LOW);

 //Added delay
  delay(50);
}

I've tried putting a while loop inside the void MotorValue method, but all that does is repeat the first letter and then it stops.

Any advice would appreciated... :)

Currently you only save one character. If you want to process all of the characters in a line more than once you will need to save the entire line. See: https://www.arduino.cc/en/Serial/ReadString and https://www.arduino.cc/en/Serial/ReadStringUntil.