What drives firms to produce quality goods in a market economy?

The basis of the market mechanism is individual freedom in making and implementing economic decisions. Entrepreneurs, resource owners and consumers enjoy freedom of choice in a market economy.
Enterprises have the right to purchase factors of production at their discretion, to produce those goods and services that they consider necessary, to choose the method of their production; in this case, decisions are made at their own expense, at their own risk.
Resource owners can use the resources as they wish. This also applies to the owners of labor resources, they can engage in any type of work that they are capable of.
Consumers can buy the goods and services they want within the limits of their income. In a market economy, the consumer occupies a special position, it is he who decides what the economy should produce; if the consumer is unwilling to buy goods and services, then firms will go bankrupt.

Remember: The process of learning a person lasts a lifetime. The value of the same knowledge for different people may be different, it is determined by their individual characteristics and needs. Therefore, knowledge is always needed at any age and position.