I didn't separated the logic of the game from the rendering stuff
This is great progress!
I know, when you reach the point where you realize "oh no, I made a huge mistake three weeks back, and now I have to change everything", it doesn't feel like great progress, but it is.
You learned the importance of keeping rendering separate from the game logic. You won't make that same mistake again. That's the big progress you made. It will save you months to years of coding in the future.
so now I have thrown everything away
Ha, I used to do that too, it feels like a total failure, get rid of it :)
Nowadays, my habits are less drastic. The point is, that besides that one big mistake, you also made a lot of good decisions there. I usually leave the code alone for a few days (I am too angry about it to make sane decisions otherwise). After some days I have cooled down enough to have another go at it. If you use version control, you can go back in history, and find the spot where you made that error for the first time. If you don't use version control, make a new directory, and copy the bits of code that are not involved in the problem. A third approach is to make a copy of your code, and comment all broken parts out, but that doesn't really work for me.
Now you have the new program that partly works, and the broken program that has bits and pieces of functionality that the new program does not have. The next job is to take the good bits from the broken program, and put them in the new program in the right way. I usually just write the code anew while looking at the old code. Basically, it's salvaging the useful bits of the old program, while writing new pieces, avoiding your previous mistake. In your case, you could rescue the auxiliary code (loading sprites for example), and the pure rendering bits and pieces, probably in a new structure that you have to invent first. The idea is that you did a lot of thinking behind each line of code, by doing copy/paste of the good lines, you're saving yourself the effort of doing that thinking again.
For completeness, there is another way to do the above. It's called refactoring. Your program is working, but the structure is wrong. Refactoring is changing the structure of the code such that before and after the change everything works in the same way, but with a better structure. The approach here is usually to slowly separate the game logic from the rendering by making small rewriting steps. Before and after a step the code all works, but after each step, the game logic is a bit more separated from the rendering than before. By doing that often enough, you can fix your mistake, while the program continues to work.
It's a more difficult skill, but very useful to have!
I am going to make the game from scratch again, but this time I want to do things correctly.
I also aim for that each time, but it hardly ever happens. Problem is that we make tens of decisions in each line of code, and we are far less perfect than we like to believe. It's a matter of time until you make a wrong turn somewhere, at least I never wrote a program without error in it, beyond the "hello world" scale of programs (and even there, I am very capable of making a typo in the message :p ).
Don't be afraid of errors. You cannot avoid them, programming is a complex activity, and you're not a computer that doesn't make mistakes[1]. Instead, learn how to cope with errors without losing a lot of time.
As for tools, I am not sure. I hear people use libgdx, but I know nothing about it. Perhaps other people will provide you with other suggestions.
One thing to keep in mind is that a new tool will not reduce the complexity of programming. If you know how to use the tool, it will probably help you, but if you don't know the tool, you move from 1 problem (programming the game) to 2 problems (programming the game, and understanding the tool). Adding problems to your plate will at least not make things quicker. It will also not eliminate errors.
However, check it out. Have a look at the tool, ignore all the fancy pictures and marketing stuff. Look at the documentation, try it for say a day to a week. If you feel comfortable in it, it may work for you.
[1] And even computers do make mistakes. There are error rates of CPUs. They are very low, but not 0, so every now and then, even the CPU messes up :)