The reason the debugger is showing an error is because on line 21 you are using get_node, but without passing a node path to it, just an empty string. you probably need to replace line 21 with get_parent().add_child(myjoint) and that should fix the script so it adds the node to the scene.
Also, looking at the script, this will make a new join every time the down action is pressed without removing the old joint. If you want to remove the old joint, then you'll need to replace lines 27+ with the following:
if Input.is_action_just_pressed("down"):
if (myjoint != null):
myjoint.queue_free()
myjoint = null
Hopefully this helps!
(Side note: Welcome to the forums!)