I'm going to take different view to @DaleM and say you cannot take liability for damage caused by a previous tenant, notwithstanding that you purported to agree to that.
I know you stated that you "took over the tenancy" but I'll start with the assumption that what you mean is that you signed a new tenancy agreement with the landlord (containing a clause agreeing to be liable for past damage), as this is by far the most common scenario in practice. I'll then examine the alternative scenario. I've asked in the comments for you to clarify how you entered into the tenancy agreement.
New tenancy agreement
In a new tenancy agreement, you cannot take liability from a previous tenant in england-and-wales, due to the provisions of the Tenant Fees Act 2019. I'm open to being convinced otherwise if anyone has an alternative interpretation of those provisions.
A landlord must not require a tenant to make a prohibited payment:
Section 1(1): A landlord must not require a relevant person to make a prohibited payment to the landlord in connection with a tenancy
of housing in England.
Section 1(9): In this Act “relevant person” means — (a) a tenant, [...]
The starting point is that all payments are prohibited. Exceptions to this are then listed in Schedule 1 of the Act. If it's in the Schedule, you can require payment; if it isn't, you can't.
Section 3(1): For the purposes of this Act a payment is a prohibited payment unless it is a permitted payment by virtue of
Schedule 1.
Payment for damages relating to breach of contract is permitted:
Schedule 1, Paragraph 5: A payment of damages for breach of a tenancy agreement or an agreement between a letting agent and a
relevant person is a permitted payment.
In a typical tenancy agreement, failure to return the property in the condition you found it (allowing for fair wear and tear) is a breach of contract. Hence, it is not prohibited for landlords to require their tenants to pay for damage to property.
The issue here is that your dad committed the breach under his tenancy agreement. Under your tenancy agreement there has been no breach. Therefore, requiring payment from your dad is permitted; requiring payment from you is not. Any clause which purports to do so is unenforceable on the tenant:
Section 4(1): A term of a tenancy agreement which breaches section 1 is not binding on a relevant person.
Novated tenancy agreement
It's possible that instead of signing a new tenancy agreement, you novated the old one. This means that all three parties (the landlord, your dad, you) agreed to substitute you for your dad as a party. It is not possible for only you and the landlord to agree to a novation. That's because the outgoing party gives up their rights as well as obligations; hence their consent is required.
Although this is commonly be described as "stepping into the shoes" of the outgoing party, strictly speaking this is not what happens. Rather, the old contract (between A and B) is extinguished and a new contract (between A and C) is formed on the same terms (or partially on the same terms, depending on what the novation states).
Under a novation, the default position is that pre-novation liabilities remain with the outgoing party. It's possible (and common) to expressly provide something different, which is what has purportedly happened in your case.
That raises an interesting question as to the effect of Schedule 1, Paragraph 5. In my view, while you can expressly provide that liability can transfer from B to C in a novated contract, you cannot provide that breaches can transfer. A breach is a factual occurance and it's nonsensical to rewrite history by saying that C committed a past breach which in fact B committed. Instead, what you can do is say that C agrees to be liable for that past breach. Saying otherwise would be incompatible with the principle that a novated contract is a new contract which extinguishes the old.
Accordingly, my view with regards to Schedule 1, Paragraph 5 is the same as if you had signed a new tenancy agreement (which is effectively what you have done with a novated tenancy agreement). You did not commit the breach, therefore asking you to accept liability for it under the novated contract is prohibited.
Note also that it is permitted to require payment of £50 or the landlord's costs in relation to the novation, whichever is greater. However, in my view this applies to only to the outgoing party, being "the tenant" who makes the payment "in consideration" of the novation of "the tenancy" which is done "at the tenant's request" (all of which implies we're talking about the existing tenancy, not the new one). The language would appear to exclude the possibility that the incoming party can legally be required to make the payment:
Schedule 1, Paragraph 6:
(1) A payment is a permitted payment if it is a payment — (a) to a
landlord in consideration of the variation, assignment or novation of
a tenancy at the tenant's request, [...]
(2) But if the amount of the payment exceeds the greater of — (a) £50,
or (b) the reasonable costs of the person to whom the payment is to be
made in respect of the variation, assignment or novation of the
tenancy, the amount of the excess is a prohibited payment.
If I'm wrong and the landlord also released your dad from liability for damage to the carpet (which is not necessarily implied by the fact that you agreed to be liable), then it could perhaps be argued that such release is a "cost" for the purposes of sub-paragraph 1(b) above. However, I would counter-argue that it isn't really a "cost" since it was taken on voluntarily (the landlord could have simply had your dad remain liable which is the default position) and it isn't "reasonable" for the same reason.