Hi,
The cost of the repairs to the vehicle cannot be added on to the purchase price or deducted from the selling price.
In your example the margin would be £400 as that is the difference between the purchase and selling price.
The repair of the vehicle is an overhead so you would be entitled to the reovery of input tax on the service subject to the normal rules.
You can see guidance here:
Introduction to input tax
Thank you.