Almost. He said that if anyone could present a plan on how to end world hunger for $6B, he'd sell Tesla stock to pay for it.
The U.N. publicly presented a plan on how they'd use that $6B, but it fell way short of that goal. Which isn't surprising, since they never claimed they could solve world hunger permanently for $6B. Musk's challenge was rhetorical because the bar was impossibly high. He was really just trying to make the point that he does not have the money to truly end world hunger.
As much as I dislike Musk, I think your argument is a bit of a straw man. He responded to something or someone saying it was possible for $6bn. They stopped responding after Musk said "open books for accounting" or something. The UN shouldn't have responded at all since it wasn't feasible
I still think it's interesting information, and feeding 42 million people for a year is a better deal than funneling that money to people like musk or the DoD.