the footnotes in my bible states the following:
The story of the woman caught in adultery is a later insertion here, missing from all early Greek manuscripts. A Western text-type insertion, attested mainly in Old Latin translations, it is found in different places in different manuscripts; here, or after 7, 36, or at the end of this gospel. There are many non-Johannine features in the language, and there are also many doubtful readings within the passage. The style and motifs are similar to those of Luke, and it fits better with the general situation at the end of Lk 21, but is was probably inserted here bbecause of the allusion to Jer 17, 13 (cf the note on 8, 6) and the statement, “I do not judge anyone,” in 8, 15. The Catholic Church accepts this passage as canonical scripture.
I have also heard with regards to what was being written, that it was the sins of those who were condeming the adulterous woman (and that their sins were comparable). But, as to where the text came from originally, the specifics appear to be questionable, except that they were inspired. This much, due to the fact that the Church knowingly includes it in the Canon of the bible, we know to be true.
Just my two cents on the subject,
CARose