The income taxes are not refundable just because you later leave the country. The taxes are based upon the income you've earned while in the US, what you did before or after is irrelevant. They cover the various government expenditures during that period (i.e.: government services you were receiving, like roads, bridges, police, security, etc etc).
Social Security taxes provide you some benefit, if you pay them long enough. While in your case you haven't gotten enough credits, many foreigners who end up staying in the US can claim the SS taxes paid while on visa towards their SS benefit credits. Unless there's a totalization agreement between your home country and the US, if you didn't earn enough credits for benefits - these taxes are lost as well. If you ever get back to the US - you can continue accumulating credits from the point you left.