Why don’t different organisms have nucleic acid genomes containing different bases and sugar?
It sounds like you are confused about how Darwinian evolution "works".  For example, as we survey the current life forms in this biosphere there is absolutely no evidence that these species (or their molecules, which you refer to) are optimized in any way, shape, or form.  All we can state with any certainty is that at some time in the past, during one, or more, selective events, all the species that used ribose, deoxyribose, and the five common bases (A, C, G, T, and U) for their genetic material, survived to reproduce, and contribute progeny to the next generation.

If that putative selective event was different, then perhaps all the pentose-based species would have died off, and we would all have hexose-based genetic material.

We don't know how many different genetic material recipes were tried out before this one "won".

Evolution can only work on, or select, or select against, the current batch of organisms.  It is not an optimization algorithm, it is a filter that lets variants through.

It may well be that our genetic material, for example, replicates faster than the other candidates. That could be a selective advantage, but it doesn't have to be.

So what are you really asking here (since your original question contains incorrect assumptions)?