As you saw, you don't need a custom element in this case.
But for anyone wanting to draw lines in custom elements, the function is drawLine(x1,y1, x2,y2), like you had, except for the capital "L".
I've never found a proper definition of what's available, but they provide some examples here: https://umlet.com/custom_elements.html