How to edit a Textmesh.text in playmode?

With my current skills I have done so far:

using UnityEngine;
using System.Collections;

public class CSescribirEnCasilla : MonoBehaviour {

TextMesh tmThis;
string sPlayerName;

// Use this for initialization
void Start () {
tmThis = this.GetComponent();
sPlayerName = PlayerPrefs.GetString(“playerName”);
tmThis.text = sPlayerName;
}

void OnMouseDown(){
Debug.Log(“On mouse down”);
tmThis.text = “newPlayerName”;
}
}

And I succeded in changing the Textmesh.text. But I want to let the player to write it, allowing him in fact to write on computers, newspapers or any other element with his keyboard in real time.

Thank you very much!

Thats going to be alot more complicated.
There are built in alternatives to allow user input
GUI.TextField

And UI InputFeild
http://docs.unity3d.com/Manual/script-InputField.html

You can then apply the text to a textMesh
If you want to skip the provided input methods, you will have to capture any input events yourself, perhaps with inputString

(note: this example uses the very old GUIText component, not textMesh)