The story in the eighth chapter of John is well known and quoted by many, but it is always said that we do not know what Jesus wrote.
I think that with a little logic and what we already know about men and God, that we can determine the general gist of the words. That is not to say that we can know the exact words.
The Pharisees and the teachers of the law brought the woman to Jesus in order to trap him: as verse six states. They must have known that Jesus would show mercy to her and that would be a violation of the law.
If Jesus would have said, do not stone her, the Pharisees would have accused him of disobeying the law and they were pretty sure Jesus would say, show her mercy.
Knowing this it was quite a test, but one cannot trick God and Jesus said and did only what his Father told him.
Suppose you were in the crowd and you had slept with another’s wife. And suppose Jesus knelt down and wrote your name, the woman’s name, and her husband’s name on the ground. You would be reminded that you, as well as the woman, were guilty of sin and by the same law that the woman was being judged, you should also be stoned to death.
Or suppose you had stolen, lets say an axe, from your neighbor. And Jesus wrote the word “axe” and your neighbor’s name: you would be reminded of your sin and you would also know that the one who wrote on the ground also knows your sin.
They, even knowing this, still kept on trying to trap him, until he had enough and stood up to say, “If any one of you is without sin, let him be the first to throw a stone at her.”
Then just to remind them again that they were not without sin, he kneeled and wrote again.
The older ones left first, because they had more sin than the younger, but eventually they all left, because they all had sin.
The lesson for me is that I cannot condemn anyone, because I am not without sin and the good news for me is that Jesus does not condemn the guilty.