Why would you do that? You have to pay loan origination fees for the refi and closing costs twice. Just sell it and keep the extra money. Unless you are a turnkey provider or are holding it past 12 months to avoid short term capital gains (even then not sure if it would make sense financially) don't bother refinancing it.
I agree with others. It just makes no sense that if you plan to sell to do a cash out refi. Do one or the other not both.