Let one number is X and other one is (X+18)
HCF=6
LCM=168
First number * second number = HCF \times LCM of the numbers
X×(X+18)=168×6
X2+18X−1008=0
X2+42X−24X−1008=0
X=−42 or 24
We take positive one.
So, required numbers are 24 and 44
So sum of the square = 24×24+42×42=576+1764=2340$