There is no law preventing this scenario from happening as you describe so it could happen in theory. The part that would make this practically impossible is that the VP appointment would require the senate to consent. It's very unlikely the senate would ever consent to an appointment of a president who resigned, especially one that was impeached.