Dynamically how to detect a gameobject and its position?

Hi,
I am new for Unity.
I have created a game it contains only one scene. I have created a Prefab, it contains a Cube. Dynamically I am creating reference for Prefab with dynamic position and adding it to a scene.
My question is; dynamically how to detect the referenced Prefab (GameObject) and its position?
Thanks in advance.

<h2>Code:</h2>
public class ClassName: MonoBehaviour{

    public GameObject myCube;

    void Update(){

        GameObject cube = myCube;

	    Instantiate(cube, new Vector3(Random.Range(-10,10), Random.Range(-10,10), z), Quaternion.identity);

    }

}

If you instantiate the prefab and assign it to a variable then you can check the variable at any point. Something like:

public GameObject cubePrefab;
GameObject cube;
    
void Start(){
    cube = Instantiate(cubePrefab);
}

void Update(){
    Debug.Log(cube.transform.position);
}