They never did build an all-British link from one end of Africa to the other. It was only after WWI, when they took over German East Africa (basically modern Tanzania) that they had the full route, and the Great Depression and the general economic silliness of the idea made it a non-starter.
They did talk about it though, and the Cape to Cairo railway (and telegraph line) was one of the imperial dreams for which Cecil Rhodes was most famous. Possibly the best known image of Rhodes is the cartoon showing him bestriding Africa like a Colossus https://en.wikipedia.org/wiki/The_Rhodes_Colossus
The scheme was certainly a big deal for him and his supporters. It was one of the many goals he had in extending British control north from South Africa, and he actually entered into negotiations with the Kaiser in 1899 about running the line through German East Africa. He was so impressed with the Kaiser that he added Germans as one of the groups eligible for the Rhodes Scholarships, which enabled men from the Empire, the U.S. (and Germany) to study at Oxford in order to become part of the future world elite and “secure the peace of the world”.
As you might gather, it was a pretty visionary plan, that had as much to do with utopian visions of a white dominated world as any economic purpose. It was supposed to be profitable. Rhodes claimed that
“The object is to cut Africa through the centre and the railway will pick up trade all along this route. The junctions to the East and West Coasts, which will, occur in the future, will be outlets for the traffic obtained along the route of the line as it passes through the centre of Africa” (Rotberg pg 594)
This is bog-standard railway imperialism. Railways were -the- way to control a territory and integrate it into the imperial and world economies. They were ways of controlling ‘native’ peoples but also benefiting them. They were symbols (and tools) of imperial military, economic and racial dominance. Both the Portuguese and the French were talking about West to East trans-Africa lines, so Britain clearly had to be first!
Economically it never made much sense. Railways (and telegraphs) were an important part of spreading British economic and political power, but a full Cape to Cairo line would require hundreds of miles of track that would serve no purpose other than drawing a “Red Line” across Africa. As such the British government was always very cool to the idea of providing any money for it, and the after the death of Rhodes in 1902 the scheme became more or less impossible even after they took the German territory.
Sources
Rotberg, Robert I. The Founder Cecil Rhodes and the Pursuit of Power. Oxford: Oxford University Press, 1988.
The most recent thing on this is
Betto van Waarden, A Colonial Celebrity in the New Attention Economy: Cecil Rhodes’s Cape-to-Cairo Telegraph and Railway Negotiations in 1899, The English Historical Review, Volume 136, Issue 582, October 2021, Pages 1193–1223, https://doi.org/10.1093/ehr/ceab327