First you need to create the array (unless it has been created elsewhere).
Then you can set values to it like so array[x][y] = value;
What you have is called a jagged array. They are usually used when each row have different lengths. In your case you could use a two-dimensional array.
// Jagged array
public class Background : MonoBehaviour
{
public int backgroundWidth = 7;
public int backgroundHeight = 12;
public GameObject[][] background;
public GameObject cube;
private float transform_x;
private float transform_z;
void Start()
{
transform_x = -6f;
transform_z = -11f;
background = new GameObject[backgroundWidth][];
for (int x = 0; x < backgroundWidth; x++)
{
background[x] = new GameObject[backgroundHeight];
for (int y = 0; y < backgroundHeight; y++)
{
Vector3 position = new Vector3(transform_x, 0, transform_z);
Quaternion rotation = Quaternion.Euler(90, 0, 90);
background[x][y] = (GameObject)Instantiate(cube, position, rotation);
transform_z = transform_z + 2;
if (transform_z == 13)
{
transform_z = -11;
}
}
transform_x = transform_x + 2;
}
}
}
And an example with a 2d array.
// Two-dimensional array
public class Background : MonoBehaviour
{
public int backgroundWidth = 7;
public int backgroundHeight = 12;
public GameObject[,] background;
public GameObject cube;
private float transform_x;
private float transform_z;
void Start()
{
transform_x = -6f;
transform_z = -11f;
background = new GameObject[backgroundWidth, backgroundHeight];
for (int x = 0; x < backgroundWidth; x++)
{
for (int y = 0; y < backgroundHeight; y++)
{
Vector3 position = new Vector3(transform_x, 0, transform_z);
Quaternion rotation = Quaternion.Euler(90, 0, 90);
background[x, y] = (GameObject)Instantiate(cube, position, rotation);
transform_z = transform_z + 2;
if (transform_z == 13)
{
transform_z = -11;
}
}
transform_x = transform_x + 2;
}
}
}