I have a view loop of post A, and i want to create a link that once pressed will connect this post A to a specific post B (I have post B ID passed by URL). I have also created relastionship between post A and B.
Probably easier to include a relationship form directly in the output of your View and pre-populate and hide the post selectors so that you just show a button to connect posts.
If you are using post relationship form then it offers the attribute parent_item and child_item using which you can pre-populate the parent and child item within the post relationship form.