NAIROBI, Kenya — The president of Somalia’s transitional government on Thursday appointed a Harvard-educated prime minister who said he would try to revive Somalia’s war-wrecked economy and establish better security in a country that has been virtually lawless for 20 years.