For motivation, battle with my teams, i cook them up and they are terrible! **Just Kidding!** (even though it still loses all the time)
Losing is not the reason for leaving actually, build a team on showdown, use it, fix up the mistakes and in the end you will get a REALLY good team. I made a UU team using this process and got from 1000 to 1350 very quick!
Also, when battling gym leaders, try something unexpected. I have my battlespot rating in the high 1200s but i still enjoy it! Now i planned the kind of team i am gonna use to grind back up, its VERY unexpected, a trick room for singles! I just have to EV train 3 of my mons and then i am done!
Now, coming back to the topic, quitting just because you lose is not the reason, but it is a reason to come back with a stronger attack!