Very often there is nothing wrong at all with Cat D motors. I used to buy, repair and sell on accident damaged cars many years back. The main reason for Cat D cars is that the repairers which insurance companies use tend to seriously rip the insurance companies off.
As an example, my missus has a small prang in her car last year. She rolled into the back of someone at about 20mph. I priced up the replacement parts needed - bumper, radiator, 1 spotlight, and maybe a new bonnet if i couldnt repair the old one. Came to about £400 all in, including paint. But, because there was another car involved we went through the insurance company.
The Insurance company took the car to their repair shop and came back saying that her car was a boarder line write off!!!! But, they decided to repair it in the end and we got it back. I got a copy of the repair invoice from the bodyshop and they charged the insurance company £3200 for the work, and the car was only worth about £3750 or so.
Had the insurance company decided to write the car off, I would have bought it back, and for £400 got it repaired properly.
The key thing really if you buy an accident repaired car is to try and establish what was repaired / replaced and how badly damaged it was before the repair. Just because it was written off, it does not mean the car is dangerous or even been involved in a major serious accident.