Your question is about Psalm 137:9. Verses 8 and 9 together state, "O daughter of Babylon, who art to be destroyed; happy shall he be, that rewardeth thee as thou hast served us. Happy shall he be, that taketh and dasheth thy little ones against the stones."
I assume that the problem is with God giving a blessing on those who dash little ones against stones. And, though I know that God's ways are not always our ways and His judgments are often accused of being cruel by those who have no understanding of godly judgment, the understanding of this verse is incorrect. God is not recommending the smashing of babies' heads. Let me explain.
First, this verse is predictive and not prescriptive. That is, God is foretelling the future; He is not giving instructions on what He wants others to do. This is very important. Babylon had been exceedingly cruel to Israel as well as to other nations. In judgment, they would receive the cruelty they had given. However, the Israelites to whom this psalm is written were not the ones who would apply the judgment. That was left to the Medes and the Persians. God was not instructing them what to do; He was telling them what would happen.
Second, the man (presumably a soldier) who does this thing shall be happy. However, there is nothing to indicate that God encourages this particular action. Rather, He is predicting that those who are part of this slaughter will rejoice, will be happy in their actions, will be rewarded for their cruelty, etc. They will probably even go about bragging about their actions. Looking back historically, we know that Babylon's destruction came after a long siege which resulted in cruel actions by the victorious soldiers. This is often the case in such a battle. The soldiers go mad when they finally achieve the victory and do many cruel and terrible acts. This passage points out that the type of cruelty given out by the Babylonians will be received by them from their enemies. Their sins will return upon them, and the men who do it will rejoice in their cruelty.
This happiness is not of the permanent, divine sort. The Bible mentions several cases of those who are happy, even outwardly blessed, though their actions are wicked. However, this happiness will not continue forever. Jeremiah asked, "wherefore are all they happy that deal very treacherously?" (Jeremiah 12:1). Malachi accuses the Israelites, "And now we call the proud happy; yea, they that work wickedness are set up; yea, they that tempt God are even delivered" (Malachi 3:15). But Malachi continues to say that the time will come when they will "discern between the righteous and the wicked, between him that serveth God and him that serveth him not" (v.18). Some of those who are for a time happy will be judged among the wicked and will receive their just punishment.
In conclusion, God is not commanding anyone to dash little ones against rocks. The happiness the perpetrators of this cruelty is certainly of the earthly sort and short-lived. Mainly, this passage is graphically describing the return of the cruelty of Babylonians upon themselves.