How to spawn line2d at marker2D

Godot Version

<stable4.2>

Question

<I was following some YT tutorial to make line2D ribbon effect. The problem is line2D will instantly fall down to bottom and out of screen whenever run the project. how can I keep it stay at marker2D? Also, how can I display it only under certain action and gradually disappear?

extends Line2D

var target
var point
@export var targetPath: NodePath
@export var particleCount = 0
var speedY = 75
var speedX

func _ready():
	target = get_node(targetPath)
	pass

func _physics_process(delta):
	global_position = self.global_position
	global_rotation = 0
	point = target.global_position
	add_point(point)
	while get_point_count() > particleCount:
		remove_point(0)
	for i in range(points.size()):
		if i > 0 and i < particleCount/4:
			speedX = randf_range(-20, 20)
		elif i > particleCount/4 +1 and i < particleCount/2:
			speedX = randf_range(-50, 50)
		elif i > particleCount/2 + 1 and i < particleCount * 0.75:
			speedX = randf_range(-100, 100)
		else:
			speedX = randf_range(-150, 150)
		set_point_position(i, Vector2(get_point_position(i).x + (speedX * delta), get_point_position(i).y + (-speedY * delta)))
	pass

any idea why??