functions to create term and child terms

To create a taxonomy, you should use register_taxonomy(). This function accepts three arguments:

 <?php register_taxonomy( $taxonomy, $object_type, $args ); ?> 

The documents on the codex are plenty self explanatory.

Now, to insert a term into a taxonomy, you can use wp_insert_term(). Again this function accepts 3 arguments:

<?php wp_insert_term( $term, $taxonomy, $args = array() ); ?>

You can check the codex page for instructions.