my roommates from college used to do this. I found it to be a very odd behavior, but they did it together and in front of me...then they stopped doing it in front of me and did it in their bedroom together. they used creme filled sandwich cookies (the cheap kind). I think they just wanted to eat without gaining weight, and it makes sense why someone would chew and spit. I think in the long run, this could cause digestive upsets. From a physiological point of view, this is destructive to the stomach because when you chew, your mouth releases enzymes in the saliva to break down starches. This chemcial reaction sets off a chain reaction of other digestive juices to be released in the stomach. However without the food in the stomach the digestive juices just stay there and causes an increase in the pH of your system. A higher pH level can cause ulcers in the long run.
If you are doing this often, it would cause a problem. If it's just once in a while, like the girl who did it because their boss at the chocolate factory encouraged it for the job, or like if you were a "taster" for some food company, don't worry.
However if the behavior is disrupting your life in some way, perhaps you can seek help from someone, a friend, a doctor, or counselor. Weight loss is difficult b/c of the time and effort into exercise and dieting, but eating normal again can be even MORE difficult for someone who has built up fears about gaining weight, and has built up odd eating habits.
It seems like you are aware of this behavior becoming destructive, and you are looking at the road ahead: "should I go this way or that way?" I think you know better for yourself and will choose the right path.

Take care, and don't be ashamed of this. It happens to so many people.