if 50g of MgCl2 and 50g of 0.6M NH4OH are added enough water to make 1 litre solution, how much NH4Cl in gram should be added to the solution to prevent precipitation of Mg(OH)2

(assume no change in volume)
given Ksp for Mg(OH)2 is 8.9x10^-12 and Kb=1.8x10^5

I think you didn't finish the last sentence AND you made a typo. I assume you meant Kb for NH3 is 1.8E-5. Also, I think you meant 50 mL NH4OH and not 50 g since you didn't give the density of the NH4OH.

mols MgCl2 = g/molar mass = approx 50/95 = approx 0.52 and in 1 L about 0.52 M.= (MgCl2)
(NH4OH) = 0.6 M NH4OH x (50 mL/1000) = approx 0.03 M
Here is what you need to do but first you should go through the above calculations to confirm the estimates I've given. Correct any that need correcting. Mg(OH)2 ==> Mg^2+ + 2OH^-
Ksp Mg(OH)2 = 8.9E-12 = (Mg^+)(OH)^2
You know Ksp and Mg^2+, solve for (OH^-).
NH4OH ==> NH4+ + OH^-
Kb = 1.8E-5 = (NH4^+)(OH^-). You know Kb and you plug in OH^- from the Ksp calculation above. Solve for (NH4^+). That's what the (NH4+) must be for the Mg and OH to be those numbers in the problem.
That will be in M or mols/L. Since the solution is 1 L that will be the mols. Then grams NH4Cl = mols NH4Cl x molar mass NH4Cl
Post your work if you run into trouble.