Could you let us know if you would want to correct your existing approach or if you are open for other approaches as well ?
If open for other approaches, there are already many scenarios/posts here on removing duplicate rows available, Could you maybe check on them, One of them is below :
Let us know if you were able to perform the same operation or need help in modifying it.