Rom 8:27 Now He who searches the hearts knows what the mind of the Spirit is, because He makes intercession for the saints according to the will of God.
That is the Spirit praying not the man with the Spirit. Think of it this way, you present a case before a judge, the lawyer/advocate does a better job of presenting you by placing a convincing case in ways and terms you may not know or understad. Also think of how the lawyers/advocates coaches the clients on how to appear in court, answers questions etc the Spirit helps our weakness in preparation and presentation.
As the Holy Spirit groans for us and in us, He does not distract from the will of the Father. As the Searcher of hearts, He watches the surging emotions of them in prayer, and knows perfectly what the Spirit means by the groanings which He draws forth within us, because that blessed Intercessor pleads by them only for what God Himself designs to bestow. Just like the dock does not move closer to the boat but rather the opposite, so is the Holy Spirit interceding for us moves us closer to the Father’s will.