Hi mahendra,
You can easily achieve this by using a microflow,
Just add a button from the A page which calls a microflow,
in the microflow, just create an object of B (if it doen’t exist) or change B (if exists) and link it to A.
And then show a page where you will be able to select one of the B object.
You can do this from B page also.
Hope it helps!