One of the thirty-nine categories of forbidden activity on Shabbat is “Koteb,” or writing. A person who writes two letters in a manner whereby the writing is permanent, and does not disappear, violates the Torah prohibition against writing on Shabbat.
The Shulhan Aruch (Orah Haim 340:4; listen to audio recording for precise citation) mentions several situations where writing is forbidden Mi’de’rabanan – due to an enactment of Hazal (the Talmudic Sages). Although these kinds of writing are not prohibited on the level of Torah law, they are forbidden by force of Rabbinic enactment. One such case involves writing with one’s finger in a liquid that spilled, or in a pile of ashes. It is possible to draw letters in spilled liquid or in ashes, and doing so on Shabbat violates the Rabbinic expansion of the prohibition against writing. By the same token, it would be forbidden to draw in the sand on Shabbat. (In truth, drawing in the sand on Shabbat is forbidden irrespective of the prohibition of writing, because sand is considered Mukse.)
The Mishna Berura (commentary by Rav Yisrael Meir Kagan of Radin, 1839-1933) adds another situation where writing on Shabbat is forbidden by force of Rabbinic enactment, namely, writing in the condensation on windows. Children often enjoy writing their names or other words with their fingers on windows on which condensation has formed, which is especially common in the winter. Such writing does not violate the Torah prohibition against writing on Shabbat, given that it is not permanent, but it is nevertheless forbidden by force of Rabbinic enactment.
The Rama (Rabbi Moshe Isserles of Cracow, 1525-1572) rules that it is permissible to motion the shapes of letters with one’s finger in the air. For example, if somebody wishes to describe the shape of a letter to his friend, he may “draw” the letter in the air. Since nothing is actually formed by these motions, no prohibition at all is entailed, not even on the level of Rabbinic enactment.
Summary: It is forbidden to write on Shabbat, and one may not even write with one’s finger in spilled liquid, ashes or sand. Likewise, it is forbidden to write in the condensation that formed on a window. It is permissible, however, to motion with one’s fingers in the air the shapes of letters.