Reading serial issue: also receiving characters I am sending

I am communicating through Serial2 (arduino mega) by sending and receiving text.

95% of the time the communication goes well, but some of the text I am reading contains also parts of the text I am sending.

Code:

void setup (){
  Serial.begin (19200);
  while (!Serial) {
  }
  Serial1.begin(19200);
  Serial2.begin (19200);
}

void loop (){
  currentMillis = millis();
  if(currentMillis > savedMillis + 1000){ 
    Serial2.write("@@geenbatterij##\r\n"); //check batterij
    Serial2.write("@@geensignaal##\r\n");
    savedMillis = millis();
  }
 SerialEvent2zelf();
}

void serialEvent2zelf(){
  if(Serial2.available()>0){
    while (Serial2.available()){
      processIncomingByte(Serial2.read ());
    }
  }
}

void processIncomingByte (const byte inByte){
  static char input_line [MAX_INPUT];
  static unsigned int input_pos = 0;
  switch (inByte){
    case '#':   // end of text
      input_line [input_pos] = 0;  // terminating null byte
      process_data (input_line);
      input_pos = 0;  
      startSignReceived = false;
      break;
  //  case '\r':   // discard carriage return
  //    break;
    case '@':   // begin of text
      startSignReceived = true;
      break;
    default:
      if (input_pos < (MAX_INPUT - 1) && startSignReceived == true)
        input_line [input_pos++] = inByte;
      break;
    }  
  }

Output (console reading):

odr/3.8
rnt/102h6m
as1/28.9
as2/28.8
ls1/0.1
ls2/0.1
bsn/82
kwt/74
wd1/4.7
wd2/0.7
rnt/102h6m
rpm/972
odr/3.7
rnt/102herijrnt/signaalrnt/102h6m   //<-- see here
as1/28.9
as2/28.8
ls1/0.1
ls2/0.1
bsn/82
kwt/74
wd1/4.7
wd2/0.7
rnt/102h6m
rpm/981
odr/3.8
rnt/102h6m
as1/28.9
as2/28.8
ls1/0.1
ls2/0.1

What am I doing wrong and how to solve it? Thanks.

  while (!Serial) {
  }

Why? That is NOT needed on the Mega. It is only needed on the Leonardo and Micro, neither of which have a Serial2.

You don't appear to be using Serial at all. So, how is the Serial2 data getting to the PC?

@PaulS

Deleted, dit not solve the issue but thanks for noticing.

The correct ratio of answers to questions is 1, not 0.5.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data.

...R