Determine the distance my gaze reaches and summon an entity

I want to summon an armor stand exactly where I'm looking. How can I achieve that? I've attempted to learn raycasting, but I'm still quite new to it.

Continue to help post