Problems using serial port

Well I wrote me a own function to convert the ASCII data to integer, because I only need 12 characters. But now I have another serious problem. I tried now one day to get my serial data so how I want. The sensor I read shall be part of a system that monitors temperatures and a fill level. So I get the data of the sensors etc in different time differneces, so I want to ask the level sensor also e.g. only all 10 seconds of its data. The whole system runs only this sensor not.

How can I get the 5 Bytes it sends to the Arduino in one step before the program gets to the next step? The data should also be calculated in a special way in this time, but when I take a for loop around the serial part I get the data tree times.

digital Pin 21 is only used to activate/deactivate sensor.

void setup() {
  Serial.begin(9600);
  Serial1.begin(9600);
  pinMode(21, OUTPUT);
  digitalWrite(21, HIGH);
}

boolean einmal;
int i=1;

void loop() {
  delay(4000);
  digitalWrite(21, HIGH);
  delay(20);
  
  for(i=0; i<6; i++) {
    if (Serial1.available()) {
      int inByte = Serial1.read();
      Serial.write(inByte);
      if(inByte==13) { digitalWrite(21, LOW); }
    }
  }
}