so if the measure of angle AMB = 90 so the another right triangle is formed which is ADM, since the it is a right triangle the legs are equal, then the lenght AD = DM and we can solve the length of AM
AM = sqrt( AD^2 + DM^2)
AM = sqrt( 6^2 + 6^2)
AM = 6sqrt(2)
now we can solve the length of AB
AB = sqrt ( AM^2 + MB^2)
AB = sqrt ( 6sqrt(2)^2 + 6sqrt(2)^2)
AB = 12
so the perimeter = 2(6) + 2(12) = 36