This phrase comes from a graduation speech by Admiral McRaven about the ten things you should do if you wish to change the world. It is item number 4:
Get over being a sugar cookie and move forward
Before he said this the Admiral explained that in his Navy Seal training they would perform uniform inspections. Any failure, at all, would result in the recruit needing to go lay in the ocean for a while (in full uniform) and then go lay in the sand. This was colloquially referred to as "being a sugar cookie" - should be self-explanatory.
Now, the "open secret" about these uniform inspections is that the inspector will find fault. They will, even if your uniform is objectively perfect. Why? Well the intended lesson here is that no matter how hard you try, no matter how perfectly you do something - you can still fail, and you need to pick yourself back up after you fail if you wish to move forward.
I think about this advice a lot. I have never been in the military, and I have no intension of laying in the ocean fully clothed just to roll in the sand. Back when I was trying to stop my alcohol consumption I would fall off the wagon all the time (which is normal during this process, do not be too hard on yourself if this is you). However, during my anxiety fueled hungover 4:15am stomach aches I would remind myself that I am currently a sugar cookie, that I need to get over this if I wish to move forward.
Now, this does not mean that I was to be ok with myself drinking, or being lazy, or eating junk food, or whatever it was I was trying to fix at the moment. No, this means that when you fall off the wagon or make a mistake - when you try and fail - you need to forgive yourself to move forward.
It is really hard sometimes, I know this - I have been there with you. But you can do it, you really can. If it helps, picture yourself covered in sand and brush it off.