Mastodon already has that. You can export and import posts^[@vidarh clarified below that you can only import lists, bookmarks, blocks, and mutes. Not posts.] in the settings, and under Account Settings, you can move to a different account so people are redirected to your new profile.
My screenshot doesn’t show import as an option because I migrated away from this Mastodon account to Firefish.