It's interesting that when God appeared to Job and questioned him, the result was that Job's comprehension of God's power and sovereignty increased without having his own questions answered. Instead Job had his own encounter with the God he had only heard of before. And that very encounter showed him who he was in contrast to this mighty creator God who was sovereign over all.
I don't believe God responded to Satan's taunting just to show off. God was demonstrating his own confidence in Job's character by allowing Satan to do evil toward him. God was trusting Job to handle anything Satan would throw at him. In the end, God let Job speak directly to Him and He spoke directly to Job so that Job could truly know Him. It was after that personal encounter that God restored all He took from Job and had Job intercede for his not-so-comforting friends who had blamed him for causing his own misfortunes.
It is in the rest of the Scriptures that we find the answers Job wanted concerning the purpose of suffering. Two places to find some answers are in James 1 and 1 Peter 1. Job did not have those Scriptures, yet he still understood that his purpose was to glorify God. He did that even before he personally met that God. He acted in faith. And as God said concerning Abraham, He counts faith in Him as righteousness.