How do I type through buttons?

I want to know how to type with a button just like on I would with a keyboard.

Example: I have a Button with the letter F and when I click it, a text will receive F. If I press it 3 more times I’ll have a text with “FFFF”,I wanna make a project for android that has all algarisms as buttons to type a code. How do I make it so the button send the number to a text object

sort of like the name insertion in Undertale but by clicking the button.

Attach a custom script to each button that has a function called TypeLetter(). Assign this function as an on click event on every button.

public void TypeLetter() {
    txtRef.text += GetComponentChildren<Text>().text;
}

For buttons that do other stuff (like backspace) use a different function. You may want to create a keyboard manager script as well if you want to keep track of state like for caps lock or wtv.