How do you write in a text box in the Game Engine within Blender?
If it is a text object, you can Tab into edit mode and change the text value ahead of time. If you want to edit it realtime in you game please see the following steps:

Step 1

Switch your screen layout to "Game Logic" or open a Logic Editor window.



Now add the text object and position it where you want it.

Step 2

Under the logic properties for the Text object, click the special button that says "Add Text Game Property". A new string property called "Text" will appear, but alas! you cannot edit it directly. You need some game logic. Add a normal game property, set it to boolean, and give it a name you will remember. Now create a new Keyboard sensor, enable "All Keys" mode, and under the log toggle field, select your boolean property. Lastly, under the target field, select your property "Text".



Step 3

Profit. You now have a system where you can dynamically change a text objects lettering in game, but it will only happen when you enable the boolean property. i.e. if in a first person shooter, you could set it to toggle when keypress[right enter key] so you don get long string of "WWWASASAAWWWWWWWWWDD".

Hope this works for you. Happy blending.