Jewish people do not casually write any Name of G-d. This practice does not come from the commandment not to take the L-rd's Name in vain, as many suppose.  In Jewish thought, that commandment refers solely to oath-taking, and is a prohibition against swearing by G-d's Name falsely or frivolously (the word normally translated as "in vain" literally means "for falsehood").
Judaism does not prohibit writing the Name of G-d per se; it prohibits only erasing or defacing a Name of G-d.  However, observant Jews avoid writing any Name of G-d casually because of the risk that the written Name might later be defaced, obliterated or destroyed accidentally or by one who does not know better.
The commandment not to erase or deface the name of G-d comes from Deut. 12:3. In that passage, the people are commanded that when they take over the promised land, they should destroy all things related to the idolatrous religions of that region, and should utterly destroy the names of the local deities. Immediately afterwards, we are commanded not to do the same to our G-d.