Why is the legacy code used if it has so many drawbacks ? Simply because it is unavoidable: often, during a project, a new programmer takes over the maintenance and development of the code. While the original developer of the code could understand it intuitively in most cases, new members of the team have to struggle to figure out what it does. In that case, parts of the code may not be readable or understood correctly..
When code is maintained, improved, and edited by many different programmers over many years, it can become a very difficult mosaic to understand and modify. At some point in its history, the code and its effects become incomprehensible, making it impossible to update or correct them properly.
Another drawback of legacy code is that it does not allow for regression testing or automated testing due to its patchy, inefficient, and unwieldy nature. As a result, developers dealing with legacy code have to spend a lot more effort doing manual testing , which makes bugs harder to fix and updates more difficult to implement..