The mistake you made is that you don’t use LineRenderer().SetPosition() correctly.
LineRenderer().SetPosition() requires you to fill it with the the integer as Index (this you did) and a Vector3 as position (which you didn’t as you feed it the distance… not the position you want the line to end up at).
You should feed it hit.point instead of hit.distance as this give the position (vector3) where the raycast hit.
The mistake here was that you handle the LineRenderer as if it was a Raycast (which is done toward a direction and a distance)