Did you ever work for something and then, at the very end, you did not get the the reward you thought you would get? That can be discouraging. But there is a way to ward off this discouragement. change your perspective.
Think now that the joy is in the labor, not the outcome.
This is what happened with Moses at the end of his life. He died after leading the people all the way to the Land of Promise but he never entered in.
You can have joy from planting an apple tree, knowing that those who follow will enjoy the fruit though you will be gone before he tree matures.