Trail in three.js

I’m trying to create a stroke with the mouse, but I don’t know what is the problem.

Can you please explain in more detail what your code is supposed to do? Is an effect like the following at Shadertoy already sufficient?

You have to hold the left mouse button down and then move it on the canvas to see the effect.

trail Im trying to make this