Function takes the head of the List and the data as argument and if no List exists , it creates one with the head pointing to first node . If it exists already , it appends given node at end of the last node
static node getData ( node head , int num ) {