Strictly from a scrum perspective, it sounds like what you're doing wrong is that you're not working with the client. You need to work together with the client to come to an understanding of what they need. Do they need a series of quick fixes, or do they need a stable, maintainable system that will serve them in the long term? They need to be aware that stability and maintainability aren't free, and has to be engineered into the product.
If they say it is the former, you are doing nothing wrong -- assuming you're explaining to them in the sprint reviews that you're cutting engineering corners to meet their goals.
If they say it is the latter, then what you're doing wrong is that you're not giving them what they want.