In intermediate microeconomics by Hal Varian, It is said that discriminating monopoly is better than competitive markets for producers. Why so?
You're looking for an answer while it's clear you are very early in your studies and will get to this stuff in due time.
With that said, here is some loose intuition about why a monopoly is better than competition for a single producer:
In a competitive market, every single consumer and every single producer has the same amount of "bargaining clout". In particular, no single producer can set prices however it wants, because there is always another producer waiting in the wings to offer a better price. The market-clearing price and quantity can be viewed as an equitable compromise between relatively equal powers (producers and consumers), and is "fair" in that sense. There are nuances to this that you will learn, but in economic terms producers do not earn "profit" in a competitive market. They break even.
By contrast, in a monopoly market, the single producer has (nearly) all of the "bargaining clout" because they control the means of production. Therefore, they have tremendous freedom to set the price or quantity in such a way that they earn a positive "profit" because there is no other supplier who is able to undercut them on price. This profit for the producer comes at the expense of the benefits consumers would otherwise enjoy in a competitive market (e.g., other things purchased with the price savings).
Again, these are kind of hand-wavy statements, but illustrate the general idea.
The answer to your question is that producer surplus - the difference between what the price at which a producer is willing to sell a unit of output and what they are required to sell it at - is greatest in a discriminating monopoly.
You can think of the discriminating monopolist as having perfect knowledge of every consumer on the demand curve, and as having the ability to charge each consumer the most that they are willing to pay. Therefore, the entire area between the supply curve and the demand curve before the output at which they intersect is the producer surplus (i.e the difference between AR and MC for every unit that the monopolist produces).
By contrast, the monopolist who cannot discriminate must charge the same price to all consumers and therefore cannot capture all the difference between what each consumer is willing to pay and what they are required to pay.
I hope this answers your question - I don't know whether you are alternatively asking how discriminatory monopoly power can exist.