Ah ok, yo dont want to move the body to the point instantly.. that wasnt clear in the question. So there are many ways. You first need to define if you want to move it a constant speed, or move it in a specific time, etc... also, is it a top down game? what would be your case?
For example, for constant speed, you may do something like this:
direction = global_position.direction_to($RayCast2D.get_collision_point())
velocity = direction * speed
velocity = move_and_slide(velocity)
else: #only use this if you want to stop movement after releasing
velocity = Vector2.ZERO
with speed a float and velocity a Vector2 global variables