# How can i instantiate empty gameobject to be position to existing already gameobject?

When i click on keyboards for example dfrg i want that if i click on space it will add empty gameobject right after the letter g like a space for example: drg hello So there is a space after the letter g and before the hello I want that the empty gameobject will be like space. So if i click space it should be always position after the clone. But not sure how to do it. The problem is that i instantiate the clone object after if i click on space key. And i also want the space to work for both side/cases if i first click on space before i clicked and did any clones it should be for example: dfrg There are many spaces before the dfrg

using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using UnityEngine;

public class Test : MonoBehaviour
{
public GameObject[] prefabs;
public int gap = 50;
public int offset = 0;

private GameObject go;

void Start()
{

foreach (GameObject prefab in prefabs)
{
if (prefab.name == "testing")
{
go = prefab;
}
}
}

void Update()
{
if (Input.anyKey)
{
if (Input.GetKey(KeyCode.Space))
{

}
foreach (Transform child in go.transform)
{
if (Input.inputString == child.name)
{
Transform clone = Instantiate(child);
clone.parent = transform;

clone.transform.eulerAngles = new Vector3(0, 0, 0);
offset += gap;
clone.transform.position = new Vector3(-offset, 0, 0);
}
}
}
}
}