How to escape while control structure with implement of switch case

Try this. I don't think you need the while's - if a key press is not received, just switch based on the last key that was received.

void loop()
{
key = kpd.getKey();
 if(key)  // Check for a valid key.
  {
    new_key  = key;
  }
 switch (new_key)
    {
      case '1':
                Serial.println("1");
        break;    // supposed that break the case 1 if other case is being pressed
:
:
} // end switch
} //end loop