Make a trail inside the bge
positions variable is being cleared at every execution of the script by the line own["positions"] = [] to prevent this replace that line with :

if 'positions' not in own :
    own["positions"] = []




Edit :
The position list was not extended properly it was taking pointers to the object position to fix this replace own["positions"].append(own.position) with own["positions"].append(own.position.copy())