If you don't know how to correctly structure a game, you should start learning how to abstract their elements into game-independant blocks.
This may help you in many ways (besides being interesting), such as: experience dividing abstractions from implementations, a better exploiting of inheritance and interface design, or just how to put the game into multiple files for it to look pro (or to provide a fexibility of implementations by the use of dynamic link libraries or other interface uses). Sooner or later you'll realize that everything can be done and then you will find yourself without that motivation problem anymore (you just do it).
I had the same problem when I got stuck at first, but the best solution is to keep moving, or you can stall forever until something resets you somehow (and it may take too long). It doesn't matter if you just code 2 lines some days, but every day you have at least to open the project and try to improve something (it's a neverending task but that's not the problem).
If at some point the program doesn't work, you should undo what you did last (keep a backup use an svn or at least a .rar with the name of the date) to a point it did work, and try to do it again, or work on other changes you need to do until you want to try again.
At first you should try to fix the error with the help of the debugger, but I don't know if your language even supports a debugger... but if you by chance use C++ or something like that (which I would recommend if you want to make games), you should make better use of your debugger as it will help you a lot for finding the error fast in a single run.
Reading about game programming is also a good thing to keep on the topic if you don't want to work on anything in particular. There are some good books and articles about game engines and design you can find online.
You won't be able to do anything if you don't practice. Trying to find a bug can be very frustrating at first but then you learn that it's actually easy if you know how to do it. This is something you learn how to avoid with the time, by coding in a way your changes don't impact in the whole program, decreasing the amount of places on where to look for the error. If every time it gets difficult you give up, then every next time you think on making a game you will give up before starting. Just learn how to overcome the bad moment by overcoming it :P If you don't pass through that moment in which you lose motivation, your laziness will win, and you will lose, that's how it works, until you learn how to regain motivation without much effort.
PS I was wondering... what are you using to make the game?