How to get from 2 endpoints of a line to xyz location and xyz rotation?

I have the end points of a line (x1;y1;z1) and (x2;y2;z2). How do I calculate the x-y-z-rotation (of thin cylinders) so Unreal gives me this line, starting at one point and pointing in the right direction (and ending in the second point)? The x-y-z-location for the cylinder is “easy”, (x2-x1;y2-y1;z2-z1).

I have tried this: Spherical coordinate system - Wikipedia, putting inclination in y, azimuth in x, and z=0, gave not the result I wanted.

I’m trying to recreate something like this:

261131-square.jpg

It consists of all straight lines, still gives the impression of a curved surface.
I have tried positioning the cylinders manually, didn’t succeed as rotation is done around the center, not the endpoint of an actor.
In total I have 19 lines, for which I have the endpoints calculated.

261134-element.jpg