Hello Warren,
The shutdown is likely happening because the loose CPU cooler is no longer making proper contact with the processor. I would avoid turning the PC on again until the cooler has been securely remounted.
This may only require a replacement mounting pin, bracket, or CPU cooler with fresh thermal paste. It is difficult to estimate the cost without seeing which part broke, so having a local repair shop inspect it would be the safest option.