How can I let the User draw a curve in BGE while playing?
Trail Object

This object represents a single step on the trail. The x-dimension should be exactly 1.0. Make it "no collision" in physics tab to avoid interaction with other objects.

To appear as a line use plan that gets scaled to 0 on the y-axis. Give it a material with wire frame to make it visible with exactly one pixel width. It should reside on an hidden layer (otherwise add object will not work).



Trailed object

Is the object that should leave a trail. Typically you add one trail per step. Then align the trail to the last position of the trailed object and change the size that it completely fills the step.



The script can be like that:

import bge

INTERNAL_PROPERTY_LAST_POSITION = "_last.position"

AXIS_X = 0

controller = bge.logic.getCurrentController()

owner = controller.owner

lastPosition = owner.get(INTERNAL_PROPERTY_LAST_POSITION)
currentPosition = owner.worldPosition.copy()
owner[INTERNAL_PROPERTY_LAST_POSITION] = currentPosition

if lastPosition is not None:
    direction = lastPosition - currentPosition 
    for actuator in controller.actuators:
        actuator.instantAddObject()
        trail = actuator.objectLastCreated

        trail.alignAxisToVect(direction, AXIS_X)
        trail.worldScale = 3*[direction.length]


Result



Remarks


This creates quite a lot of trail objects. At a certain number it will cause lags.
You can increase the step size by increasing "skip" at the always sensor of the trailed object. It creates less objects but results in less precise trailing and a small delay.
trail objects with a bigger width can result in overlapping and gaps. This depends on the shape and material.