cursor generates new code but doesn't delete old one

Today a problem appeared that the program generates new code, but does not delete the old one and as a result there are two identical codes in one file