You could either create a 2d profile of the entire length of that section of railing including the height and angles at both ends then extrude the width and rotate it after.
Or, you could create a profile of the end of the railing and sweep it along a path, (such as the lines you have already), however, by default the sweep command uses the center of the profile as the base point, so sweeping along your existing paths would offset the railing high and left or high and right depending on the line you choose as a path.
You can either move the base point on the profile or an easier way would be just create a new path using the centers of each post.
I think the first method would be much easier since you will have already created the angles on the top and bottom, where, by the sweep command you would have solid hitting solid conflicts you would need to clean up.
Hope this helps