How can I draw a swigly line in unity

I need to draw a swigly line between two points in Unity using a script, I've just started working with unity 2 weeks ago so I'm new at it. For reference, this is what I mean by a swigly line

LineRenderer


You can use a line renderer to draw it, and you should use a function kind of

for(x=0; x<length; x++)

Y = sin(x);

Line.setpoint(x,y,0);