Solution :
Consider the given figure,

From the above figure, it can be seen that the direction of currents in a long straight conductor $$XY$$ and arm $$AB$$ of a square loop $$ABCD$$ are in the same direction. So, there exist a force of attraction between the two, which will be experienced by $${F_{BA}}$$ as
$${F_{BA}} = \frac{{{\mu _0}liL}}{{2\pi \left( {\frac{L}{2}} \right)}}$$
In the case of $$XY$$ and arm $$CD,$$ the direction of currents are in the opposite direction. So, there exist a force of repulsion which will be experienced by $$CD$$ as
$${F_{CD}} = \frac{{{\mu _0}liL}}{{2\pi \left( {\frac{{3L}}{2}} \right)}}$$
Therefore, net force on the loop $$ABCD$$ will be
$$\eqalign{
& {F_{{\text{loop}}}} = {F_{BA}} - {F_{CD}} = \frac{{{\mu _0}liL}}{{2\pi }}\left[ {\frac{1}{{\left( {\frac{L}{2}} \right)}} - \frac{1}{{\left( {\frac{{3L}}{2}} \right)}}} \right] \cr
& {F_{{\text{loop}}}} = \frac{{2{\mu _0}iL}}{{3\pi }} \cr} $$