Can't log mpu6050 and gps data to sd card at the same time

I am working on a school project, where I have to log GPS and acceleration data to an sd card at the same time, but I cannot get it to work. Logging GPS and acceleration data separately work fine.
The mpu6050 used to measure acceleration uses i2c communication, and the neo-GPS 6m uses softwareSerial.

The code doesn't even write the csv titles in the setup()

#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include "SoftwareSerial.h"
#include <MPU6050_tockn.h>
#include "TinyGPS++.h"

int RXPin = 3;
int TXPin = 2;
String fileName = "data";
int count = 0;
bool file = false;
float deltaTime;

MPU6050 mpu6050(Wire);
File dataFile;
TinyGPSPlus gps;
SoftwareSerial serial_connection(RXPin, TXPin);

void setup(){
//Serial begin
  serial_connection.begin(9600);
  Serial.begin(9600);


//SD card begin
  if (!SD.begin(4)) {
    Serial.println("initialization failed!");
    while (1);
  }

//Checks if file already exists
  while(!file){
    if(SD.exists(fileName + ".csv")){
      count++;
      fileName = "data" + String(count);
    }else{
      file = true;
    }
  }

  
  dataFile = SD.open((fileName + ".csv"), FILE_WRITE);
  if(dataFile){
    dataFile.print("time");
    dataFile.print(",");
    dataFile.print("x");
    dataFile.print(",");
    dataFile.print("y");
    dataFile.print(",");
    dataFile.print("z");
    dataFile.print(",");
    dataFile.print("GPS_time");
    dataFile.print(",");
    dataFile.print("Latitude");
    dataFile.print(",");
    dataFile.print("Longitude");
    dataFile.print(",");
    dataFile.print("m/s");
    dataFile.print(",");
    dataFile.print("km/h");
    dataFile.print(",");
    dataFile.print("altitude (m)");
    dataFile.print(",");
    dataFile.println("satellites");
    dataFile.close();
    
  }else{
    Serial.println("error opening sd card");
  }

//MPU6050

  Wire.begin();
  mpu6050.begin();

  Serial.println("initialization done.");
  
  delay(100);
  deltaTime = millis();
}


  
  
void loop(){
  
  while(serial_connection.available()){
    gps.encode(serial_connection.read());   
   } 

  mpu6050.update();
  

  dataFile = SD.open((fileName + ".csv"), FILE_WRITE);
  if(dataFile){
  
    dataFile.print(millis()- deltaTime);
    dataFile.print(",");
    dataFile.print(mpu6050.getAccX());
    dataFile.print(",");
    dataFile.print(mpu6050.getAccY());
    dataFile.print(",");
    dataFile.println(mpu6050.getAccZ());
    dataFile.print(",");  
    dataFile.print(gps.time.value());
    dataFile.print(",");
    dataFile.print(gps.location.lat(), 6);
    dataFile.print(",");
    dataFile.print(gps.location.lng(), 6);
    dataFile.print(",");
    dataFile.print(gps.speed.mps());
    dataFile.print(",");
    dataFile.print(gps.speed.kmph());
    dataFile.print(",");
    dataFile.print(gps.altitude.meters());
    dataFile.print(",");
    dataFile.println(gps.satellites.value());
    dataFile.close();
    }else{
    Serial.println("Does not log data!");
  }
  
  
  Serial.print(millis() - deltaTime);
  Serial.print(" X: ");Serial.print(mpu6050.getAccX());
  Serial.print(" Y: ");Serial.print(mpu6050.getAccY());
  Serial.print(" Z: ");Serial.println(mpu6050.getAccZ());
  Serial.print(","); 
  Serial.print(gps.time.value());
  Serial.print(",");
  Serial.print(gps.location.lat(), 6);
  Serial.print(",");
  Serial.print(gps.location.lng(), 6);
  Serial.print(",");
  Serial.print(gps.speed.mps());
  Serial.print(",");
  Serial.print(gps.speed.kmph());
  Serial.print(",");
  Serial.print(gps.altitude.meters());
  Serial.print(",");
  Serial.println(gps.satellites.value()); 
  
  }

Interesting project that has been solved many times. Also there is no way most computers can do more then one thing at a time unless they have more then one core or processing unit. They do it step by step but are extremely fast. Therefore you can log GPS and acceleration data to an sd card sequencly but not at the same time. I am assuming you are an engineering student, and this is part of your assignment. I will not give you the answer although it is not to complicated. You are assigned the task of learning and this is one of the many tools the professor is using. Someday you may be designing something critical and have no clue as to what you did nor could you explain it. Purchase a arduino cookbook, skip a few parties and read it. Go on line their are a lot of tutorials on the arduino and after a while it will be easy for you to figure out. This response is to help you get started in solving your problem, not solve it for you.
Good Luck & Have Fun!
Gil

Thank you for your answer, I have solved the problem, but now I have a new one. You sound like knowing what you are talking about, mind helping me?

Edit: This project is not my assignment but rather a tool for one.