how to target entities i'm looking at?

so i've been making a magic system and i have wanted to make a long range damage spell thing but i don't know how to make it actually hit other entities

Continue to help post