We have the vector from A to B, call it C. We can normalise it: c = C/|C|
The first step is to find a vector perpendicular to c. We pick one of the basis vectors, x, y or z. (If the dot product reveals that we picked one close or equal to c, we pick one of the other two instead.) Suppose we have picked x. We find the component of x in the direction of c:
(x•c)c
and subtract it from x to get a vector perpendicular to c:
J = x - (x•c)c
which we can then normailse to get j. Now use the cross product to get another unit vector, perpendicular to both c and j:
k = c × j
Now we can pick any angle θ and get a point on the unit circle centered on the origin and normal to c:
p = cos(θ)j + sin(θ)k
If we choose a point D on the line between A and B, we can find a point on the inot circle centered on D and normal to c:
q = cos(θ)j + sin(θ)k + D
Now vary D from A to B, and θ from 0 to 2π, and you're done.