He told her to sin no more.
What part of that do you not understand?
So she couldn’t marry someone after she was forgiven? That is what this Catholic teaching is saying. Certain sins can’t actually be forgiven. Jesus said and John affirmed that the only unforgivable sin was to blaspheme the Holy Spirit
Remember, Mary the mother of Jesus descended from King David’s adulterous relationship with Bathsheba. Now strictly speaking, Bathsheba’s first husband was dead when Nathan was conceived, but that was only because David had him murdered.
Not to forget Judah and his child of harlotry, Perez, with his daughter-in-law Tamar.
But that was Old Testament stuff and has no bearing on Catholic doctrine.