Yes it's fine, as phenry says above. So we've seen repeated "to," and "in." Most prepositions can be stacked this way, and some demonstratives:
She put the paper I wrote on on the
He said that that was correct.
However, most editors would spot this kind of construction and feel uneasy about it. Yes, these kinds of things are technically, grammatically correct, but they look awkward and clumsy, as if the writer didn't look for a more elegant alternative, viz.:
"She took the paper I had written on and placed it on the table," and "He said, 'That is correct.'"
No, these two examples are not the only available rewrites, there are other solutions. The point is that any solution that works will be more idiomatic than the originals. This is another installment of Just Because You Can Doesn't Mean You Should.