How did Americans australians new zelanders canadians and south africans get their accent if they were decendants from british people?

All of these countries were colonized by British people from different regions of Britain, not to mention to earlier populations and immigrants from other countries. Not all people in Britain speak with the same accent--RP, what most people outside of Britain think of as a "British accent" is actually spoken by a very small number of people. Based on the political and social climate of the British Isles, people from different regions would be more likely to emigrate to one place or another. The English spoken in all of the countries you mentioned was also influenced by the accents of the people who came in from countries other than Britain as they learned English, and you can't discount the words and accents borrowed from the native inhabitants of each of the former British colonies.