Let P(x1,y1),Q(x2,y2) be end points of diameter.
Given
x1,x2 are the roots of x2+2ax−b2=0
y1,y2 are the roots of x2+2px−q2=0
⇒x1+x2=−2a, x1x2=−b2
⇒y1+y2=−2p, y1y2=−q2
Equation of circle having PQ as diameter is
(x−x1)(x−x2)+(y−y1)(y−y2)=0
⇒x2−(x1+x2)x+x1x2+y2−(y1+y2)y+y1y2=0
⇒x2+y2+2ax+2py−b2−q2=0