This should work m8. Your code wasn't working because your logic worked like this: for every enemy, go through all the lines an reassign them, meaning you'll end up only seeing the lines being changes for the last enemy. I added if count > 2: count = 2
below for you because it seems as though you only have two lines to work with, so if there were more enemies than lines you'd have a problem.
func _input(event):
if event.is_action_pressed("shoot"):
enemies = enemy_detection_area.get_overlapping_areas()
var lines = $Thunder.get_children()
var m = $Muzzle
var count = enemies.size()
if count > 2: count = 2
for i in range(count):
print(enemies[i].global_position)
lines[i].points[0] = m.position
lines[i].points[1] = to_local(enemies[i].global_position)