How to set a text on selected inputfield?

I will have 2 or more Input Field and on screen keyboard made out of buttons.

How to input it on current selected input field?

I want to able use this script over and over on different scene that have different amount of Input Field between each scene.

Thanks