How to reassign a GameObject as a different object in scene in C#

Hey, I’m trying to add a system in my game where when you fly through one gate its deleted and a new gate spawns. The issue that im having is once a gate is destroyed i need to reassign the next gate to the GameObject of the previous gate. T

void Update ()
    {
        if(GameObject.Find("Ring") == null)
         {
            print("null");
            GameObject CurrentGate = GameObject.Find("Ring(Clone)");
      
         }
        else
        {
            GameObject CurrentGate = GameObject.Find("Ring");

Here is where the new Gate is created:

void SpawnNewGate()
    {
        
        GameObject Ring = Resources.Load("Ring") as GameObject;
        GameObject NewGateObj = Instantiate(Ring) as GameObject;

        CurrentGatezPosition.z = CurrentGate.transform.position.z;
        CurrentGatezPosition.y = CurrentGate.transform.position.y;
        CurrentGatezPosition.x = CurrentGate.transform.position.x;

        CurrentGatezPosition.z -= Random.Range(20,100);
        CurrentGatezPosition.y -= Random.Range(20, 100);

        NewGateObj.transform.position = new Vector3(CurrentGatezPosition.x, CurrentGatezPosition.y, CurrentGatezPosition.z );

        
        
    }

I tried doing GameObject CurrentGate = GameObject NewGateObj and that didnt work either

Thanks for Help in advance.

@carellidm
Here is a quick example of how I think you should destroy and spawn a new gate:

    void SpawnNewGate()
    {
        //Get the current gate whatever it is
        Transform currentGate = transform;

        //Get the parent object that is holding the current gate
        Transform parent = currentGate.parent;

        //Destroy the current gate because we have its parent so it is no longer needed
        Destroy(currentGate);

        //Instantiate new gate
        GameObject newGate = Instantiate(gameObject);

        //Parent new gate to the parent of the old gate
        newGate.transform.parent = parent;
    }

@carellidm

You should not keep finding the gate in Update but assign the value of currentGate at the time when you spawn the new gate. Take the variable currentGate globally and not locally in the function.

 void SpawnNewGate()
 {
    Transform gateParent = currentGate.transform.parent;
    
     GameObject Ring = Resources.Load("Ring") as GameObject;
     GameObject NewGateObj = Instantiate(Ring) as GameObject;

     CurrentGatezPosition = currentGate.transform.position;
     GameObject oldGate = currentGate;
     Destroy(oldGate);
     NewGateObj.transform.parent = gateParent;
     NewGateObj.transform.position = new Vector3(CurrentGatezPosition.x, CurrentGatezPosition.y - Random.Range(20, 100), CurrentGatezPosition.z - Random.Range(20, 100));
     currentGate = NewGateObj;
     CurrentGatezPosition = currentGate.transform.position;
     
 }