Oh, I think I see the issue. Yeah, the issue is that you are using global rotation, so for straight lines going up, down, left, right, you are getting the global rotation rather than the rotation relative to the last point.
Here's what I might try doing to get something similar to what you are looking for:
func _process(delta):
var last_angle = null
var angle_difference = 0
for point_angles in range(all_points.size() - 1):
if (last_angle != null):
angle_result = (int(rad2deg(abs(point_draw.angle_to_point($draw_line.points[point_angles-1])))))
angle_difference = last_angle - angle_result
print ("Angle result: ", angle_result, " | angle difference: ", angle_difference)
else:
angle_result = (int(rad2deg(abs(point_draw.angle_to_point($draw_line.points[point_angles-1])))))
last_angle = angle_result
Then from point to point in a line, you should get 0 or close to. Then if you suddenly get a 90 (or close to) angle difference, that would indicate the line took a 90 degree turn. Now, I'm not sure how you would detect a square out of that though, as it would need to detect 4 turns at 90 degrees and know that the shape is enclosed...