You would need to file a peition for modification of the custody order. See an attorney to help with the process.
I hope you found this answer helpful and if so, please let me know by clicking the "Mark as Helpful" button at the bottom of this answer. It’s easy and appreciated. You can also choose a "best answer" if you wish. This is easy to do and greatly appreciated.
This advice is not meant to create an attorney-client relationship and is a general anwer to the question posed.
You need to go to court and seek to modify the custody arrangement so that you have physical custody. The court will determine if this change in custody is in the "best interests of the child".
In order to change the physical residence in a custody order, you must show the Court there has been a "change of circumstances." Your facts state that this under 10 child moved in with you for "a few months" and is now seeing local doctors and may be going to a new school. These facts, among others, i.e. the reason why the child moved out of the other custodian's town, the child's opinion, etc. will go towards a Court's consideration as to whether there has been a "change of circumstances."
Sometimes, in these situations, mediation can be helpful. If not, you should gather your facts, visit a local attorney and commence a petition that seeks to modify an existing custody order.