In Leviticus (under the Law) a person confessed their sins to a priest and the priest atoned for those sins by offering something to God on behalf of the sinner. They confessed out loud to the priest, not quietly to God by themselves.
Jesus makes the statement “Do not think I came to abolish the Law, I came to fulfill it.” in Matthew 5:17. If confession were not part of the New Covenant, Jesus would be a liar, because he would have abolished confession in the Law. Like all the Sacraments, he took what was already in the Law and made them sources of saving Grace. This is such an important part of the New Covenant that Jesus made a point of affirming the power God gave man to forgive sins in Matthew 9:6-8:
“But that you may know that the Son of man hath power on earth to forgive sins, (then said he to the man sick of palsy,) Arise, take up thy bed, and go into thy house. And he arose, and went into his house. And the multitude seeing it, feared, and glorified God that gave such power to men.”
In John 20:23, Jesus reaffirms His teaching, stressing the importance of confessing sins to one another, and establishes that only those who are appointed are to be given this power and authority: “Whose sins you shall forgive, they are forgiven them; and whose sins you shall retain, they are retained.”
And it is clear that the apostles understood the proper mode of confession:
“Confess therefore your offences to one another, and pray for one another, that ye may be healed. The fervent supplication of the righteous man has much power.” - James 5:16
It is the confession of sin directly to God (or Jesus) that is not biblical.