tft print over lines

i'm trying to implement an EEG monitoring system using arduino and Mindflex and a some leds.i used a fonciton to read and compare the data got from the mindflex and return one String of the State we reading but when i try to print it on the tft it shows the messages over each other like this.

#include <RA8875.h>
#define RA8875_INT 4
#define RA8875_CS 10 
# define RA8875_RESET 9
#include <Brain.h>
#include <Arduino.h>
#include <String.h>
//declaring the pins 

#define RELAY1  3
#define RELAY2  9
#define RELAY3  10
#define RELAY4  2
#define RELAY5  11
#define RELAY6  12

RA8875 tft = RA8875(RA8875_CS,RA8875_RESET);



Brain brain(Serial);


void setup() {
  pinMode(RELAY1, OUTPUT);       
  pinMode(RELAY2, OUTPUT);
  pinMode(RELAY3, OUTPUT);
  pinMode(RELAY4, OUTPUT);
  pinMode(RELAY5, OUTPUT);
  pinMode(RELAY6, OUTPUT);
   Serial.println("RA8875 start");
tft.begin(RA8875_480x272);
tft.fillWindow(RA8875_BLACK);// initialize a ST7735S chip, black tab
delay(1000);
Serial.begin(9600);
}

void loop() {
  // put your main code here, to run repeatedly:
 long tab[6];
 int ti[2];
  String msg;
 if (brain.update()) {
       if (brain.readSignalQuality() > 100) {
     tft.fillWindow(RA8875_BLACK);
     tft.setCursor(0,30);
     tft.setTextColor(RA8875_RED,RA8875_BLACK);
     tft.println("signal quality low");
}


else {
         tab[0] = map (brain.readDelta (),300000,500000,0,1023);
         tab[1] = map (brain.readTheta(),10000,29000,0,1023);
         tab[2] = map (brain.readLowAlpha(),30000,40000,0,1023); 
         tab[3] = map (brain.readHighAlpha(),6000,9000,0,1023);
         tab[4] = map (brain.readLowBeta(),4000,8800,0,1023);
         tab[5] = map (brain.readLowGamma(),700000,900000,0,1023);
         ti[0]=brain.readSignalQuality();
         ti[1]=brain.readAttention();
         ti[2]=brain.readMeditation();
         lam(ti);
         msg=writeComp(compar(tab,6));
         Print(ti,6,msg);

  

}

 }
 }


 
///////////////////////////////////////////////////////Fonctions/////////////////////////////////////////

int compar(long* array, int size){  //fcontion to compare the inputs taht we put in an array and return the index of the max 
 int maxIndex = 0;
 int max = array[maxIndex];
 for (int i=1; i< size; i++){
   if (max<array[i]){
     max = array[i];
     maxIndex = i;
   }
 }
 return maxIndex;
}
String writeComp (int val){//    here is a fonction to make the use of the index of the max and use it to create a message to write once onll te reduce the time of computation
  
  String mess;
  switch (val) {

    case 0 :
         mess=String("Sleeep")       ;        
    break;
    case 1 :    
           mess =String("Relaxed, mediative");
    break;
    case 2 :
           mess=String("Relaxed, eyes closed");
      
    break;
    case 3 :    
               mess=String(" power value");

    break;
    case 4 :   
               mess=String(" alert, foucsed");
    break;
    case 5: 
               mess=String("multi sensing");
    break;
    default: 
   mess=String("ERROR ");
   break;}
  
return mess;  
}
void lam(int* b){
if (b[0] < 25) {
   if (b[1] < 50) {
   digitalWrite( RELAY1, HIGH);
   digitalWrite( RELAY2, LOW);
   digitalWrite( RELAY3, LOW);
 
 
 }
 
 else if (b[1] >70)
 {
   digitalWrite( RELAY2, HIGH);
   digitalWrite( RELAY1, LOW);
   digitalWrite( RELAY3, LOW);
   
   
   }
   
   else if (b[1] < 70 and b[1] > 50)
   {
     digitalWrite( RELAY3, HIGH);
   digitalWrite( RELAY1, LOW);
   digitalWrite( RELAY2, LOW);
  
   
 
 }
}
  
}
void lamp (int b){

  if (  10 > b){
      digitalWrite(RELAY1,1);           
      digitalWrite(RELAY2,1); 
      digitalWrite(RELAY3,1);  
      digitalWrite(RELAY4,1);  
      digitalWrite(RELAY5,1);  
      digitalWrite(RELAY6,1);} 
      else if (20 >=  b <= 45)
      {digitalWrite(RELAY1,0);           
       digitalWrite(RELAY2,0); 
       digitalWrite(RELAY3,0); }
      else if (45 <= b >= 75){
      digitalWrite(RELAY4,0);  
      digitalWrite(RELAY5,0);  
      digitalWrite(RELAY6,0);}
      else  if (b < 75){
      digitalWrite(RELAY1,0);           
      digitalWrite(RELAY2,0); 
      digitalWrite(RELAY3,0);  
      digitalWrite(RELAY4,0);  
      digitalWrite(RELAY5,0);  
      digitalWrite(RELAY6,0);}
  
}
void Print(int* ar, int size,String m){
tft.setCursor(30,0);
   tft.setTextColor(RA8875_WHITE);
   tft.setFontScale(0);
   tft.println("Brain states mapping system");

   
  tft.setCursor(0, 30);
  tft.setTextColor(RA8875_YELLOW,RA8875_WHITE);
  tft.print("signal quality :");
  tft.print(ar[0]);
  tft.println(" ");
  tft.setTextColor(RA8875_RED,RA8875_WHITE);
    tft.print("Attention      :");   
    tft.print(ar[1]);
    tft.println(" ");
  tft.setTextColor(RA8875_BLACK,RA8875_WHITE);
    tft.print("Meditation     :");
    tft.print(ar[2]);
    tft.println(" ");
  tft.setTextColor(RA8875_RED,RA8875_WHITE);
   tft.setTextColor(RA8875_WHITE);
   tft.setFontScale(0);
   tft.print("The actual state is : ");
   delay(1000);
   tft.print(m);
   tft.println(" ");
  
}

Easy fix would be...

Replace

tft.print("The actual state is : ");

With

tft.print("The actual state is : ");

This will do it but you can probably find a more elegant solution. try to understand printing at an absolute location rather than relative (I mean, you tell it where to start each time you print, line, position) - That would be better for all printing....

You have very carefully setTextColor(foreground, background) for all the other text.
Then set transparent mode for White text.

Either set cursor and print spaces then set cursor again.
Or just print text with some trailing spaces.

David

yes thats it i did what u asked and its working now thanks