I don't think there's an afterlife. Nor do I think we were put here by anything other than mindless processes.
If we were put here by a being that had, in it's mind, some purpose for us, only it would know for sure, but things can be created for temporary purposes as well as for lasting purposes.
Sand castles aren't meant to last forever. They occupy, for a short time, the attention of those that build them. Building them may satisfy the urge to craft and create, and the castles may be admired and appreciated by those that observe them, but then, having served their purpose, they are abandoned, to be obliterated into non-existence by the forces of nature.