trouble incrementing index

loop() is already a loop, you don't need another loop "while (Serial.available() > 0)", just use something like this:

if ( Serial.available () > 0 ) 
{
  static char input[16];
  static uint8_t i;
  char c = Serial.read();

  if ( c != '\r' && i < 15 ) // assuming "Carriage Return" is chosen in the Serial monitor as the line ending character
    input[i++] = c;
    
  else
  {
    input[i] = '\0';
    i = 0;
    
    //do whatever with input string...
    Serial.println( input );
  }
}