Yeeup, this is a pickle. I won’t lie. To the point others have made, if you’re here for absolution, you’re not going to get it. Most people have severely negative views on cheating and it sounds like you cheated, so … facts. But it doesn’t matter, really, what anybody here thinks of you personally, so don’t sweat it. I myself would seek moral guidance about the fact of having cheated elsewhere … from a parent, priest, rabbi or whatever. Personally, I don’t care how you feel about it and my operating assumption is that what you really regret is (maybe) getting caught. But none of that matters or helps. As for what to do now, I would separate the moral from the tactical; because having this show up on your transcript is a biggie.
What you’re really here to ask, I think, is how to gauge the odds of whether you were not in fact observed cheating vs. the odds that you were caught and the teacher isn’t going to rat you out regardless of whether you confess vs. the odds that you were caught and the teacher won’t rat you out only if you fess up. And, of course, nobody here knows. If it were me, I’d assume I’m busted and I’d also assume that my contrition might well be the difference between the teacher reporting it or not. But it’s a gamble; you might be fessing up to something that you really got away with.
Here’s one idea: go talk to your school counselor about colleges. If this doesn’t come up, then your teacher hasn’t turned you in and probably won’t. They tend to deal with these things pretty quickly.
Also, I would not plan on asking this teacher for a LOR, regardless of how this plays out.