How to type a text with UI Buttons

These numbers are UI buttons from unity.
That 1456 is a text.
I was wondering how I can type to that text any number by clicking those buttons.

Each button should register their own number. Then on press, they add their value to a string that is printed.

public Text content; 
public void OnNumberPress(int value)
{
       content.text+= value.ToString();
}

Assign this method to each button component and then give the value in inspector. content is the reference to the text you want to display the full value.