You'll need a camera that has shutter speed control to about 30 seconds or Bulb mode. Of course you'll to do this in the dark and you'll need a flashlight. Since the shutter will be open for quite some time, you will also need to stabilize your camera like by mounting it on a tripod.
Set your camera to manual and select the Bulb mode or 30 seconds shutter speed. Set aperture to smallest f/number and take a shot of the background of your scene. You are doing this to make sure you get the background you like. Even if it is dark, the long shutter time will allow light from far away to enter the camera making the background illuminated somehow. If you find the background too bright, adjust aperture to a higher f/number until you are satisfied with what you see. You have to make the background dark enough for the light tracing to come out. It doesn't take much darkness to do that. Sometimes, it's good to see most of the background even.
Practice doing the light painting to get it in time. If you are writing words, make sure the light can be seen by the camera. It is better if you wrote backwards while facing the camera. Take a shot. Don't rush. You can always do it over again. That's the beauty of digital.
If the light painting is too bright, cover the light end of the flashlight with your finger or hand. The light may become reddish due to your blood but that's another special effect. I find single led lights better. If your flashlight is huge, step back farther away from the camera. You should get something like the picture here.
Now you know!