So like in n.america Europeans moved and settled in but even after independence white people were still present in America(I mean the early Europeans did kill off the native Americans). The same goes with south africa but in s.africa they didnt kill a large number of the indegenous black people. So why are there a lot of white people in countries like these but not in other countries colonized by Europeans like say Ivory Coast, Kenya etc
Your question is predicated on the exceptions to the general rule of thumb when it comes to decolonisation. The United States was never subject to this process, and South Africa's demographics are the result of a colonial struggle for power.
Firstly, the United States is a very unique case that cannot be compared to colonial African nations at all. The United States formed as a country, compromised of white Europeans, very early on in the history of colonialism, and since its existence it has been responsible for its own affairs. It is also, as I noted, a country created out of a series of colonies populated almost entirely of white Europeans - the indigenous were not at all involved in its creation. In very basic terms, when the United States was created, these white Europeans became the future American people in a form of early nationalism. As the United States expanded, the population grew at a commensurate rate and thus ensured that the most populous and dominant demographic in America were the whites. Think settlers and frontiersmen - people living in the former Thirteen Colonies, spreading westward.
In the African colonies however, white Europeans also colonised but they weren't necessarily coming to settle permanently. Some did, but Africa in particular was seen as source of great wealth, initially in slaves and agriculture but later in mineral riches too. The British in particular are often accused of theft because businessmen and entrepreneurs would set up companies to strip the land of wealth and move on. King Leopold II of Belgium was one of the world's biggest mass-murderers because he set up and ran the Congo Free State as a private enterprise, using the African people as a workforce and funnelling all the profits back to Belgium. Because these African colonies weren't necessarily established with settling in mind, and also because the tribal populations of Africa were quite large, the white Europeans never became the dominant population. Once the age of imperialism ended with the advent of the Second World War, African nationalism set in and the colonial overlords were seen as the enemy by the native Africans, who increasingly viewed their European masters with distrust and hatred, as occupying powers of their country. Various uprisings in the colonies indicated to the central European governments that perhaps the African colonies were no longer safe, and with the vast debts many imperial powers were saddled with after the Second World War, the expense and danger of continuing to manage and protect the African colonies proved too burdensome, and decolonisation set it. Many white Europeans living in Africa faced seizures of their wealth and property by the newly independent African nations, so they decided to leave before they were forced to leave. And later on, many were forced to leave if hadn't already. Nasser of Egypt expelled many white Europeans when he came to power in the 1950's. Idi Amin and Robert Mugabe did the same in Uganda and Zimbabwe respectively.
Now we come to South Africa. South Africa was originally settled by the Dutch East India Company, and therefore the Dutch came to establish settlements in Cape Town and elsewhere in the seventeenth century. The rule of the Dutch East India Company was extremely tyrannical, and it drove these Dutch people to such desperation that they fled inland, away from the original colonies near the coastal areas, to escape repression. These "trekkings" as they became known, continued sporadically for as long as the colony was under imperial rule, either by Holland or by Britain. In 1795, the British began to take an interest in the Cape Colony. Back in Europe, Holland had been annexed by France and therefore the former Dutch Colony was nominally under the authority of the revolutionary French government, which was at war with the British. When the British gained complete control over the Cape Colony in 1814, the Dutch people who had moved inland had become their own distinct identity, the Boers. When the Cape Colony was granted independence in 1931, there were then three different ethnic groups; the white British, the white Boers, and then the native black tribes. It is worth noting that the white groups were still a minority, about 20% of the overall population, yet as apartheid set in, the minority ruled over the majority and would do so until the victory of Nelson Mandela and the ANC in 1993.
In summary, a better question to ask might have been, "Why are there apparently more white people in South Africa than in other African nations?" Processes of decolonisation and the rise of nationalism in Africa ensured that the white population in former African colonies would either leave voluntarily, leave forcibly, or stay and be treated very badly. The United States is unique in that the white European settlers became the American people and as you pointed out, would kill a lot of the indigenous people of the continent. And South Africa is different because of the three ethnic groups that were present in South Africa at the time of independence, both Brit and Boer agreed they disliked the blacks more than they disliked each other.