How to make a Path in Realtime?

I want to the player be able to draw a path in real time and then a character will walk that path.
How would I go about doing this?

Here is what I like to do

What do you use in not real time?