I think what you are looking to do is find the amount of biomass stored in the earth's surface, crust and oceans, and then apply a value of stored energy for that amount.
This is part of the carbon cycle.
https://earthobservatory.nasa.gov/features/CarbonCycle https://www.fs.usda.gov/ccrc/topics/global-carbon
One factor that must be accounted for is the large amount of energy that ends up locked into fossilized life, basically a percentage of life is transformed into minerals and stone (Like seashells, petrified wood or limestone) and although the energy is still there it is in an unusable form at this point in time.