Apparently, someone else was awarded custody, or at least temporary custody, because it probably looked to someone as if you had abandoned the children. This might have been caused by your cousin, or someone close to her; it might have been started by someone at the children's school, possibly because of an innocent remark that one of them made.
You need to plan how you are going to explain your actions, since the time you left the children with your cousin. Admitting that you've made some mistakes, learned from them and corrected them, is often a better approach than refusing to admit you did anything at all wrong. Lawyers have a lot of practice, shaping testimony to best protect a person's interests, and you should hire one.