because in that case the sinner makes more witnesses of his sin, all of them would cause trouble for him on the day of judgment. One should keep it secret between oneself and one’s LORD, and ask for forgiveness with an intention of not repeating it. By sharing with others or committing a sin in anyone’s presence (doing it together) the sinner is in a way advertising that sin, because some innocent people (who have not yet committed that sin) might also develop curiosity of trying that sin to see how does it feel. THIS makes it a greater sin than a person who committed it secretly (even though sinning secretly will also lead to punishment, if one does not repent and ask Allah for forgiveness).
Also by sharing with people, the sinner loses his/ her respect in the eyes of people with whom s/he shares it. With time the secret might be leaked to other people and hence most of the people would develop dislikeness for the sinner even though they themselves might not be more pious than him/her.
The only exception according to my knowledge is in the case when a person wants to get an advice from a scholar or educated people (online/offline), even in that case s/he should not mention himself as a sinner but as a third person asking on the behalf of the sinner in order to preserve his/her own dignity and self respect. Even online, at times it is not difficult to trace the true identity of the person who is presenting himself/herself as a sinner.
I remember a hadith from a scholar’s speech that once a person came to the Prophet (saw) and said, " I have committed zina (adultery)“. The Prophet (saw) replied to him, " Go! you have not done it, may be you only kissed”
When the Prophet (Saw) is hiding the sins of people and trying to keep it as secret as possible, why do people themselves share it with others and discuss other people’s sins in their absence ?
p.s. I do understand that at times it is alright to share with one sincere person we trust the most in order to get consolation and remove the burden of guilt from our shoulder and find a way to start our life with a new beginning. In that case it is not the quality of that person but blessing of Allah (swt) upon those people whom Allah (swt) make a source of sincere guidance and consolation for people like me (who need to correct their sins and mistakes)