Read and write in csv file in the same object

I want to read data from a csv file and compare it to certain value. If the condition is true I want to write some data on the same row. But if I open File in File_write mode it places cursor at the end and if I open it in read mode than I am unable to write data. Is there any way in which I can open the file in read and write mode in the same file object.
Here is the sample code

atten= SD.open(date_file);
  if(!atten)
    Serial.println("Error opening atten file");
  }
  while(atten.available()){
    
    String aname, intime, offtime,t;
    id= atten.readStringUntil(',');
    intime= atten.readStringUntil(',');
    offtime= atten.readStringUntil(',');
    
    if(strcmp(id.c_str(),tid.c_str())==0){
      Serial.println("marked");
      Serial.println(intime);
      
      int hr, mint, sec,diff;
      char s[3];
      sscanf(intime.c_str(),"%d %s %d %s %d", &hr, s, &mint, s, &sec);
      
      diff= (Clock.getHour(h12,PM)-hr)*60+(Clock.getMinute()-mint);
      Serial.println(diff);
      Serial.println(offtime);
      if(offtime.length()>3){
        if(diff>5){
          String Time;
          Time+= String(Clock.getHour(h12, PM), DEC);
          Time+= String(" : ");
          Time+= String(Clock.getMinute(), DEC);
          Time+= String(" : ");
          Time+= String(Clock.getSecond(), DEC);
          offtime=Time;
          atten.println(offtime);
        }
      }
      Serial.println(offtime);
      atten.close();
      return;
    }
    t=atten.readStringUntil('\n');
  }