During whole life we are trying to make good life, but we are not thinking about our good death. I think the death is more painic then life.
So if we try to make our death beautiful then our life will be more beautiful.
And this can be done by good karmas during whole life.