Displaying the whole list in a single Text

I’m a beginner to Unity,
and want to make one sheet of input history,
which is expected to show as (1, 2, 1, 2, 3,…) endlessly.
But I can only pick one of numbers from the list, stating by mylist[1] in order.
Is there any way I can state the whole list, and display as a Text?

GameObject counter;

public List<int> brain = new List<int>();

// Use this for initialization
void Start () {
    this.counter = GameObject.Find("Counter");

}

// Update is called once per frame
void Update () {
    if (Input.GetKeyDown(KeyCode.Space))
    {
        brain.Add(1);
           }
    if (Input.GetKeyDown(KeyCode.RightArrow))
    {
        brain.Add(2);
    }
    if (Input.GetKeyDown(KeyCode.LeftArrow))
    {
        brain.Add(3);
    }
    counter.GetComponent<Text>().text = brain[0].ToString(); 

}

Use this method to convert your list to string:

private string ListToText(List<int> list)
{
    string result = "";
    foreach(var listMember in list)
    {
        result += listMember.ToString() + "

";
}
return result;
}
Use it like this:

counter.GetComponent<Text>().text = ListToText(brain);

What you need is a for or a foreach loop.

Please see below a quick example of using a foreach loop

GameObject counter;
    public List<int> brain = new List<int>();
    // Use this for initialization
    void Start()
    {
        this.counter = GameObject.Find("Counter");
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            brain.Add(1);
        }
        if (Input.GetKeyDown(KeyCode.RightArrow))
        {
            brain.Add(2);
        }
        if (Input.GetKeyDown(KeyCode.LeftArrow))
        {
            brain.Add(3);
        }

        counter.GetComponent<Text>().text = ""; //Clear the text
        foreach (int item in brain) //Add each item to the text
            counter.GetComponent<Text>().text += item.ToString() + ", ";
    }