Very quickly and sorry it's so scruffy, but this might help.

Considering only the right hand integral and leaving the 1/(b-a)^2 outside the bracket,

Expanding and integrating and then substituting a and b into the result brings out the terms in your third line.

Note I have taken the factor of 1/4 outside the bracket which means multiplying the terms inside through by 4.

The next step is to sparately do this for the left hand integral and you will need to take out the 1/(b-a)^2 outside the bracket, multiplying the result of substituting 0 and a into the left hand integral.

This does indeed lead on to line 4

Please ask if you need me to work this out as well.

As a matter of interest this looks like an evaluation of the expectation via the state variable in one dimension, between x= a and x = b.

Normally in 3 dimensions the integration variable is radial r.

It is not shown in your extract why the modulus of A squared is 3/b so I ahve taken this on trust.

Perhaps you would like to explain this?