Can i buy and sell with agreement for deed Need help

A seller call me with a house worth 300,000. He is out of town and has a 235,000 mortgage. I offered him a 15,000 down payment at closing and asked him to take back a note for 15,000 at 7%. I want to buy with an agreement for deed because he wants to make sure i pay off the loan before he deeds me the property. My backdoor is i am going to sell the property with an agreement for deed. My question is this a good plan and is it legal?