You do not like your job.
And you want to change it.
But you have spent years doing it.

Won’t all of that go to waste?

That isn’t the right question to ask.

Instead the right question is: “If I don’t make the move I want to make, what about the years ahead that would be wasted?”

The time spent commiting a mistake isn’t time wasted.
The realisation that it is a mistake stops it from getting wasted.