It is not necessary to go back to home country and apply for F1 visa. You can apply for change of status ( COS) from H1B to F1 by remaining in US itself.The only COS not permitted is from B1/B2 to F1.