Like @narnian said, we really dont know what he wrote on the ground. However, I can add to the speculation.
Someone once suggested that Jesus could have written on the ground the names of all the men who slept with the woman. When the law clearly mentions that both the man and the woman should be punished, the Pharisees only brought the woman in front of Jesus to try to "test" him. Writing the names of the adulterous men would have given far more emphasis when Christ Jesus said "He that is without sin among you, let him first cast a stone at her."
Once again, we can only speculate.