The survival of biological organisms is not a “purpose”, it is a cause. Biological organisms that failed to survive are no longer around, Trilobites for example. Biological organisms that have succeeded in surviving are still with us, sharks for example.
Survival is not a “purpose”, it is a cause. It is the reason those organisms still survive today.
The fact is, biological organisms over time, whether random or otherwise, produce qualities or features that conveniently express its instinct to survive and procreate.
Any random that increases the number of offspring will increase in the population. The process is a bit like compound interest. As an example, take a stable population; on average each organism has one descendant in the next generation. Now let a beneficial mutation appear with a 1% advantage, so the mutated organism will have on average 1.01 descendants in the next generation. See what happens if we let the population reproduce for one thousand generations:
Generation Normal Mutant
---------- ------ --------
0 1.00 1.00
1 1.00 1.01
10 1.00 1.10
100 1.00 2.70
500 1.00 144.77
700 1.00 1059.16
1000 1.00 20959.16
You can see how the small 1% advantage is amplified over the generations as the mutant variant spreads through the population.
This is a very simple model, but it is enough to show the advantage a beneficial mutation has and how it can spread through a population. This is simple mathematics spreading an advantageous mutation. There is no more complex mechanism needed. If you have more offspring, on average, then, on average, you will have more copies of your genes in the next generation.