SD card problem with Wio-terminal

Okay. I have had tried sometimes to see what could be wrong with the code but could not find it.
So I am pasting the code. The code has i2c sensor MPU6050, GPS module, LCD and SD card related lines.

#include <MPU6050reg.h>
#include <Wire.h>
#include "MPU6050IMU.h"
#include <SPI.h>
#include <Seeed_FS.h>
#include "SD/Seeed_SD.h"
#include <TFT_eSPI.h>
#include <SoftwareSerial.h>
#include <TinyGPS++.h>
#include <seeed_line_chart.h>
#include <seeed_graphics_base.h>
#include"TFT_eSPI.h"
#include <seeed_graphics_define.h>

#define LCD_BACKLIGHT (72ul)

#define MAX_SIZE 100

doubles accdatax, accdatay, accdataz;
int ax, ay, az;

TFT_eSPI tft;
TFT_eSprite spr = TFT_eSprite(&tft);

// Choose two Arduino pins to use for software serial
int RXPin = D1;
int TXPin = D0;

//Default baud of NEO-6M is 9600
int GPSBaud = 9600;

//create a TinyGPS++ object
TinyGPSPlus gps;

// Create a software serial port called "gpsSerial"
SoftwareSerial gpsSerial(RXPin, TXPin);

File accelLog;
File gpsInfo;

MPU6050IMU imu;
float temp[3];

void setup() {
  // put your setup code here, to run once:
  Wire.begin();
  Serial.begin(9600);  
 // while (!Serial){}

  // Start the software serial port at the GPS's default baud
  gpsSerial.begin(GPSBaud);

  //begin the SD card to store the data.
  Serial.print("Initialize the SD card");
  
  if(!SD.begin(SDCARD_SS_PIN, SDCARD_SPI)){
    Serial.println("initialization failed!");
    while(1);
    }
  Serial.println("Sd card initialization done..");

  //begin the sensor
  imu.begin();
  delay(1000);
  
  tft.begin();          /* TFT init */
  tft.setRotation(3); /* Landscape orientation, flipped */
  tft.fillScreen(TFT_WHITE);
  spr.createSprite(TFT_HEIGHT, TFT_WIDTH);
  
}

void loop() {
  
  spr.fillSprite(TFT_WHITE); 
  
  gpsInfo = SD.open("gps.txt", FILE_WRITE);
  gpsInfo.println("GPS-Lat\t GPS-Lon\t Ax\t Ay\t Az\n");

  if(accdatax.size() > MAX_SIZE)
  {
    
    accdatax.pop();
    accdatay.pop();
    accdataz.pop();      
  }
  
  int range = 8;
  imu.readaccelerometer(temp, 8);
  
  Serial.print((temp[0]));
  Serial.print(" ");
  
  Serial.print((temp[1]));
  Serial.print(" ");
    
  Serial.print(" ");
  Serial.println((temp[2]));

  ax = (int)(temp[0]);
  ay = (int)(temp[1]);
  az = (int)(temp[2]);

  accdatax.push(ax);
  accdatay.push(ay);
  accdataz.push(az);


  //settings for the line graph title
  auto header =  text(0, 0)
                .value("Accelerometer data")                  
                .align(center)
                .valign(vcenter)
                .width(tft.width())
                .thickness(2);
                
  header.height(header.font_height(&spr) * 2);
  header.draw(&spr);

  //settings for line graph
  auto contentx = line_chart(20, header.height());
       contentx
              .height(tft.height() - header.height())
              .width(tft.width() - contentx.x() * 2) //actual width of the line chart
              .based_on(-8.0) //Starting point of y-axis, must be a float
              .show_circle(false) //drawing a cirle at each point, default is on.
              .value(accdatax) //passing through the data to line graph
              .max_size(MAX_SIZE)
              .color(TFT_BLUE) //Setting the color for the line
              .backgroud(TFT_WHITE)
              .draw(&spr);

  auto contenty = line_chart(20, header.height());
       contenty
              .height(tft.height() - header.height())
              .width(tft.width() - contentx.x() * 2) //actual width of the line chart
              .based_on(-8.0) //Starting point of y-axis, must be a float
              .show_circle(false) //drawing a cirle at each point, default is on.
              .value(accdatay) //passing through the data to line graph
              .max_size(MAX_SIZE)
              .color(TFT_RED) //Setting the color for the line
              .backgroud(TFT_WHITE)  
              .draw(&spr);
              
  auto contentz = line_chart(20, header.height());
       contentz
              .height(tft.height() - header.height())
              .width(tft.width() - contentx.x() * 2) //actual width of the line chart
              .based_on(-8.0) //Starting point of y-axis, must be a float
              .show_circle(false) //drawing a cirle at each point, default is on.
              .value(accdataz) //passing through the data to line graph
              .max_size(MAX_SIZE)
              .color(TFT_GREEN) //Setting the color for the line
              .backgroud(TFT_WHITE)  
              .draw(&spr);
              
  spr.pushSprite(0, 0); 
  
  gpsInfo.print(gps.location.lat(), 6);
  gpsInfo.print("\t");
  gpsInfo.print(gps.location.lng(), 6);
  gpsInfo.print("\t");
  gpsInfo.print(temp[0]);
  gpsInfo.print("\t");
  gpsInfo.print(temp[1]);
  gpsInfo.print("\t");
  gpsInfo.println(temp[2]); 
  Serial.println("log info");    
  gpsInfo.close();
  delay(50);
  
}

If you find something wrong with the code please do let me know