Many would think that death is far away. Maybe in 20, 30, or 50 years. For many that may be true for others death can come tomorrow. That is first lesson.
It is true that were we will go, whether to hell or heaven (simple enough that most major religion belief in both heaven and hell) depends on virtually the last thoughts before we die as this thought carries forward and "decides" if we go to hell or heaven. (In Buddhism, there are 6 realms of hell, ghost, animal, human, demi gods and gods realms); depending on whether our thoughts at the moment of death is virtuous or not.
But the point 2 pronged. Firstly, we do not know when we are going to die. Hence, better to always keep a virtuous mind. Second, the the thoughts that we have at the moment of death depends on the thoughts a moment before it and that depends on the moment before it and so on all the back to this moment. Hence, we need to start to have virtuous thoughts now and keep it virtuous until we die , otherwise, it follows, we will never have virtuous at the moment of death. In that case...we are doomed....!
So start practicing now.!