Arduino Uno with GPS TEL0051 V3.0

Hi, I would like some help on my code using a the TEL0051 V3.0 GPS face shield. I am trying to simply get values at setup to be used in the loop section of the code. from what I got on the Serial monitor it is definitely wrong. I keep getting inf values for my variables I want displayed. I'm not sure is the hierarchy flow of my code is correct. I have posted the code and also the serial monitor. My guess is that the GPS does not read any satellites quick enough so the setup function and the rest of the code will display inf symbols. My serial monitor only outputs once, so it did not loop. Is there a way I can obtain the initial distance and bearing once as stored variables from the GPS? I just want the DC motors to move forward and stop when distance is equal to zero. The check 'if' statement is if the initial distance subtracted from the distance traveled. Am I doing any of this right or on the right track? Should I implement an odometry style of code where I would count the number of revolutions on my wheels and find the distance traveled that way and subtract the initial distance? I am purely using just the GPS, Uno, and a DC motor controller. I will be adding sensors later, but I need my code to work with only the GPS and motors. I've also linked the sites of the components I used.
GPS:

The Motor controller:

A picture of it soldered (best I could find to what I am using):

Please and Thank you for any help
P.S. I am working outside on this. Ask any standard question needed to help me please.

PrimaryCode2.ino (10 KB)

If i try to do it in a single line the arduino will explode.

Nonsense.

  Serial.begin(9600); 
  delay(5000);//GPS ready

Waiting for the hardware to be powered up is one thing. Waiting for the GPS to have acquired satellites and actually received a fix are two completely different things.

  initdistance=calc_dist(latitude(),longitude(), inputlon, inputlat);// input long and latitude 
  initbearing=calc_bear(latitude(),longitude(), inputlon, inputlat);// initial bearing and distance
  float dynbearing=initbearing; 
  float dist=initdistance;

Declaring local variables that immediately go out of scope isn't useful.

float latitude()//get latitude
{
  char i;
  char lat[10]={
    '0','0','0','0','0','0','0','0','0','0'
  };
 
 
  if( ID())
  {
    comma(2);
    while(1)
    {
      if(Serial.available())
      {
        lat[i] = Serial.read();
        i++;
      }
      if(i==10)
      {
        i=0;
        float lat1=Datatransfer(lat,5);
        Serial.println(lat1,5);//print latitude 
        return lat1;
      }  
    }
  }
}

There is so much wrong here that it's hard to know where to begin.

This function calls ID() which might return 0 in a char. Stupid, really, as ID should return false in a boolean. Regardless, if ID() doesn't return true, this function ends WITHOUT returning anything. Bullshit.

      temp=temp*10+(data_buf[i++]-0x30);

Since the purpose of the subtraction is to convert 'n' to n, 'n' - '0' is MUCH more obvious.

    //process the data array
    while(data_buf[i]!='.')
      temp=temp*10+(data_buf[i++]-0x30);

Suppose that the array contains "12345.6789". When this gets done, temp will contain 1234.

    for(j=0;j<num;j++)
      temp=temp*10+(data_buf[++i]-0x30);

Then, you skip the decimal place, and read and process 5 of the next 4 characters. Nonsense.

Your Datatransfer function is an attempt to reinvent atof(). Why?

Why do you ASSUME that the GPS will return a specific number of digits after the decimal point?

Why do you assume that there are exactly 10 characters in each field of the $GPGGA sentence?

Why do you assume that there will be exactly 10 characters after the second comma that represents latitude? Why do you assume that every one of those 10 characters is either a decimal point or a character that represents a digit?

void loop(){
int motor = 0;
int motor2= 1;
{

The loop() function does NOT take arguments.

  if(float dist =! 0 )

declaring a local variable, with no initial value, and then comparing that to a specific value is stupid.

It's no wonder why you don't get valid data, given all of the assumptions you are making but not validating.