Spawn an object at the end of a raycast

I don’t know how to word this properly… so…

How would I go about making a cube show up at the end of a raycast if it -doesn’t- hit something. I want to make a fence around a circle perimeter, that doesn’t intersect any hills, what I have planned is that it’ll shoot a ray out in increments, if the ray hits a hill or wall it won’t do anything, if it doesn’t hit anything it’ll spawn a fence piece at the end of the ray line. I’m stuck at trying to find what the Vector3 co-ordinates of the -end- of the line would be to spawn there, am I going about this completely wrong?

If you are using this form of Raycast:

  Physics.Raycast(ray, hit, dist)

…then you can get the position using:

  var pos = ray.GetPoint(dist);

…and if you are using this form of Raycast:

 Physics.Raycast(position, direction, hit, dist)

… then you can get the position using:

 var pos = position + direction.normalized * dist;