HELP IN CODING GSM MODULE. .PLEASE

this code shows the following: Total, Occupied, Vacant

const int NumberOfSensors = 1;
const int PassengerCapacity = 12;

int sensor[NumberOfSensors] = {2};
int TotalPassengers;
int NumOfOccupied;

void Print(void){
  Serial.print(TotalPassengers);Serial.print("\t");
  Serial.print(NumOfOccupied);Serial.print("\t");
  Serial.print(PassengerCapacity-NumOfOccupied);Serial.println();
}

void setup(){
  Serial.begin(9600); while(!Serial);
  for(int p=0; p<NumberOfSensors; p++){
    pinMode(sensor[p],INPUT);
  }
  TotalPassengers = 0;
  NumOfOccupied =0;
  Serial.println("\nTotal Occupied Vacant");
  Print();
}
void loop(){

  int OldVal=NumOfOccupied;
  NumOfOccupied = 0;

  for(int p=0; p<NumberOfSensors; p++){
    if (digitalRead(sensor[p]) == LOW){
      NumOfOccupied++;
      delay(1000);
    }
  }

  if(NumOfOccupied>OldVal){
    TotalPassengers += NumOfOccupied-OldVal;
  }
  if(NumOfOccupied != OldVal){
    Print();
  }
  
}

I need help in making the algorithm of my project. I want to send a message to the gsm module and receive a certain result of the code given (Occupied & Vacant). and another message to send and receive the result(Total). all are updated value.

the code for sending is here:

#include <SoftwareSerial.h>

//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial(3, 2); //SIM800L Tx & Rx is connected to Arduino #3 & #2

void setup()
{
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);
  
  //Begin serial communication with Arduino and SIM800L
  mySerial.begin(9600);

  Serial.println("Initializing..."); 
  delay(1000);

  mySerial.println("AT"); //Once the handshake test is successful, it will back to OK
  updateSerial();

  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
  mySerial.println("AT+CMGS=\"+639075479859\"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
  updateSerial();
  mySerial.print("Last Minute Engineers | lastminuteengineers.com"); //text content
  updateSerial();
  mySerial.write(26);
}

void loop()
{
}

void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}

the code for receiving is here :

#include <SoftwareSerial.h>

//Create software serial object to communicate with SIM800L
SoftwareSerial mySerial(3, 2); //SIM800L Tx & Rx is connected to Arduino #3 & #2

void setup()
{
  //Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
  Serial.begin(9600);
  
  //Begin serial communication with Arduino and SIM800L
  mySerial.begin(9600);

  Serial.println("Initializing..."); 
  delay(1000);

  mySerial.println("AT"); //Once the handshake test is successful, it will back to OK
  updateSerial();
  
  mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
  updateSerial();
  mySerial.println("AT+CNMI=1,2,0,0,0"); // Decides how newly arrived SMS messages should be handled
  updateSerial();
}

void loop()
{
  updateSerial();
}

void updateSerial()
{
  delay(500);
  while (Serial.available()) 
  {
    mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
  }
  while(mySerial.available()) 
  {
    Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
  }
}

thank you.

So, what is the problem?

Paul

i don't where to put the code for sending and receiving in the first code given