Can I remarry if I have committed adultery with my first husband, and if not, what should I do to get it right with God?
You are asking the wrong question. "And I say to you, whoever divorces his wife, except for sexual immorality, and marries another, commits adultery; and whoever marries her who is divorced commits adultery" (Matthew 19:9). Adultery occurs when a person divorces for any reason other than fornication and marries someone else. If you are in a second marriage because you divorced your husband for committing adultery, then having sex with him is adultery as well.
If your husband divorced you because of your adultery and married someone else, then having sex with him is adultery as well.
The solution is to stop having sex with men to whom you are not married. Once you repent of your sins and following God's teachings in you life, then you will be right with God.