Had the U.S. put all of the money that went into the Iraq war
"Went" is past tense; we have built a number of military bases in Iraq and will have a military presence there from now on. Not indefinitely,
permanently.
More than half of all federal tax revenue goes towards military/defense.
into renewable energy, there would be no further need for international oil.
In order to achieve energy independence through a renewable source/s, it must be *at least as cheap and as available* as coal and oil. That's why all alternate energy forms to date (aside from *cheap* nuclear) have not been so successful.
renewable energy produced by solar (via new and improved solar panels)
Better/viable solar will eventually happen, not long after nanotech manufacturing techniques are perfected, but that's 10-20 years out, longer yet for it to be priced low enough for consumer use (a current household solar system begins at ~$15,000)
Transportation would be powered by electricity by means of energy storage devices (be it hydrogen or high-density li-ion batteries)
You need the clean/cheap alternate energy source for this (nuclear would work nicely), otherwise your car is just polluting the atmosphere with electricity from the dirty coal plant.
and provide billions of dollars to the economy by selling these technologies to foreign countries.
Foreign countries are miles ahead of us when it comes to energy tech, note the predominance of Japanese hybrid vehicles and France's almost exclusive use of nuclear energy.
Is there something wrong here?
There is, and it's going to take us quite a lot of time and money to fix it.