Instantiate an object correctly

I have written the script for instantiating an object as:

IEnumerator SpwanCubes()
	{
		while (true)
		{
                   cube=Instantiate (cube, position, rotation) as GameObject;
                    cube.tag = id;
                       yield return new WaitForSeconds (spawnrate);
		}
       }

But
This happens when the objects are instantiated
119935-capture.jpg

Can somebody tell me a correct way to instantiate this object in such a way that I can assign a unique tag to the instantiated objects?

Because you are instantiating the clone not the original prefab, try this…

IEnumerator SpawnCubes()
{
	while (true)
	{
		var cubeClone = Instantiate(cube, position, rotation);
		cubeClone.tag = id;
		yield return WaitForSeconds(spawnRate);
	}
}