How can I repair a section of carpet that a cat scratched up?
Ah, the wonders of carpet ... 

The answer is that you would be able to replace the carpet in that area, typically seamlessly, if you have more of the same carpet, such as remnants that the installers left in your attic or garage. If you don't have more of the SAME carpet -- as in, same batch, same manufacturing date, same everything -- then you will end up replacing the carpet, or giving the buyer an allowance to replace carpet as part of the closing/sale costs.