Problem in receiving the data from Bluetooth module

So, you need to set started to true when the + arrives. After each character is added (including the \r and \n) to the array, test if the last 4 characters are 'D', 'O', 'N', and 'E'. If so, set ended to true.

Before implementing this concept, I have a query. I just set the EOP marker as 'D' so so that the stuff that is read from the module can be displayed once the 'D' from the 'DONE' is detected. So logically the output should be similar to
INQ: MAC ID 1,"name 1", \r\n MAC ID 2,"name 2" D

I just included a statement to visualize every character that is stored in the array. So the readatinq function and the loop function of my program are,

void readatinq()
{
  while(mySerial.available() >0)
  {
   char inChar = mySerial.read();
    if(inChar == SOP)
    {
       Serial.println("SOP MARKER READ");
       index = 0;
       inData1[index] = '\0';
       started = true;
       ended = false;
    }
    else if(inChar == EOP && started)
    {  Serial.println("EOP MARKER READ");
       ended = true;
       break;
    }
    else
    {
     if(index < 199)
      {
        inData1[index] = inChar;
        Serial.print("index[");
        Serial.print(index);
        Serial.print("]: ");
        Serial.println(inData1[index]);
        index++;
        inData1[index] = '\0';
      }
    }
  }
    

  // We are here either because all pending serial
  // data has been read OR because an end of
  // packet marker arrived. Which is it?
if(started && ended)

  { i++;
    Serial.print("Loop executed : ");
    Serial.println(i);
    // The end of packet marker arrived. Process the packet
Serial.println(inData1);
    
    // Reset for the next packet
    started = false;
    ended = false;
    index = 0;
    count=0;
    inData[index] = '\0';
   }
}

void loop()
{
  Serial.println("Initializing");
  Serial.println("===");
  mySerial.print("===");
  delay(100);
  readprocess();
  delay(500);  
  Serial.println("LLL");
  mySerial.print("LLL");
  delay(100);
  readprocess();
  delay(500);
  Serial.print("\r\nAT+INQ\r\n");
  mySerial.print("\r\nAT+INQ\r\n");
  delay(100);
  readprocess();
  delay(25000);
  readatinq();
  delay(1000);
 
}

The output that I get is

Initializing

===

OK
LLL

OK

AT+INQ

OK
index[85]:

index[86]:

SOP MARKER READ
index[0]: I
index[1]: N
index[2]: Q
index[3]: :
index[4]: 0
index[5]: 0
index[6]: :
index[7]: 1
index[8]: C
index[9]: :
index[10]: A
index[11]: 4
index[12]: :
index[13]: 1
index[14]: 4
index[15]: :
index[16]: 7
index[17]: D
index[18]: :
index[19]: A
index[20]: A
index[21]: ,
index[22]: "
index[23]: S
index[24]: o
index[25]: n
index[26]: y
index[27]: 
index[28]: E
index[29]: r
index[30]: i
index[31]: c
index[32]: s
index[33]: s
index[34]: o
index[35]: n
index[36]: "
index[37]:

index[38]:

index[39]: D
index[40]: 4
index[41]: :
index[42]: C
index[43]: 1
index[44]: :
index[45]: F
index[46]: C
index[47]: :
index[48]: 3
index[49]: A
index[50]: :
index[51]: 5
index[52]: 6
index[53]: :
index[54]: 7
index[55]: C
index[56]: ,
index[57]: "
index[58]: C
index[59]: 1

The loop has been terminated even without the EOP marker being detected and as the EOP wasn't detected, the elements of the array weren't printed. and there are still a few characters left. the loop has stopped at index[59] abruptly.
I guess that for a split second there is no element available at the receive buffer and as the code contains

while(mySerial.available() >0)

the loop has been terminated. could that be the reason? If yes, how to resolve it?