Indeed, you just have to index the caster and add it to a group.
Every 0.03 seconds of gametime, you pick every unit in the group and update the lightning positions, apply the damage, increase a time counter and heal the caster.
When the timecounter reaches a certain amount or the distance is too large, you remove him from the group and remove the lightning.