The thing is, is that idiomatically many people often do say things like this. My example has been explored here before. I think it's because the thing is has become lexicalised as a single item (just an introduction/interjection without a "functional" verb), but you can make up your own mind.

OP's case is much simpler. The first "then" means "at that time", and refers to when you'll speak again. The second means "in that case", which implicitly refers to whatever was established by the preceding dialogue.

Because the two instances of the word have completely different senses, there's absolutely nothing unusual about the repetition. In practice they normally wouldn't even sound the same, since the first would be stressed, the second not.