God created the "tree of the knowledge of good and evil". Both this tree and the "Tree of Life" were in the "midst of the garden" - see Genesis 2:9.
God commanded our first parents not to eat of the tree of the knowledge of good and evil. This was a simple test of their loyalty and faith in God. The tree of the knowledge of good and evil was necessary for this purpose. It doesn't matter what fruit it was. It could have been an apple as popular mythology would have it. It probably wasn't but it doesn't matter. As soon as God placed a commandment on that tree - DO NOT EAT OF IT! - it BECAME the tree of the knowledge of good and evil.
Adam and Eve would have gained the knowledge of the difference between good and evil whether they ate of the tree or, when faced with the temptation, the chose not to eat of it. The actual eating of the fruit was not the most important thing. It was the choice they would make. In their decision was bound up the issues of eternal life or death.
As soon as they chose, they would know the difference between good and evil. As it turned out, they made the wrong decision and then they ate of the tree.
Access to the tree of life, for the sons and daughters of Adam, including you and me, has always been contingent on our decisions when confronted with a choice between good and evil. Let's not repeat the mistake of our first parents!
You also ask what if they had asked forgiveness? Clearly they did and they were forgiven. The sentence of death was postponed and a system of education was instituted for themselves and their progeny regarding offerings and sacrifice to remind them that the "wages of sin is death" as the Apostle Paul puts it in Romans 6:23. The sacrificial system of worship pointed forward to Christ and to the ultimate forgiveness of sins in resurrection to immortality. As Paul says in the last part of Romans 6:23 "but the gift of God is eternal life through Jesus Christ our Lord."
Note that the covering which Adam and Eve first sought was deemed inadequate by God and He provided them with coats of skins. Death was insinuated into paradise by that act as innocent animals had to be put to death. That also points to Christ - the innocent being put to death to provide a covering for the sin of the guilty. See the promise of the redeemer which follows on shortly after this in Genesis 3:15.
Note also the fact that Genesis 4 and the story of Cain and Abel indicates that there was a pre-set method of sacrifice and worship which involved the shedding of blood. Cain chose to ignore this divinely ordained method of worship and approached God on his own terms. The results were tragic. May we not make the same error in our approach to God!
I hope you have found this helpful.