지금 제대로 bst트리 추가 함수가  제대로 구현이 안되 ㅠㅠ

typedef struct linenode{
char data[400];
int special;
  struct linenode *prev;
  struct linenode *next;}
LINE;


typedef struct element{
  LINE* word[500];
  int NUMBER;
 struct element * leftchild;
 struct element * rightchild;
 struct element* parent;
}ELEMENT;
->이건 구조체

void bstInsert(ELEMENT* d,LINE* word1){
 {
  ELEMENT* temp;
 ELEMENT* find = malloc(sizeof(ELEMENT));
 ELEMENT* leaf = malloc(sizeof(ELEMENT));
 temp = d;
  
 if (temp->NUMBER==-2)
    {  
      temp->word[0] = word1;
  temp->NUMBER=1;
 }
 else
    {
  while(temp)
  {
   if(strcmp(word1->data, temp->word[0]->data) < 0)
   {
    find = temp;
    temp = temp->leftchild;
    printf("ang");
   }
   else if(strcmp(word1->data, temp->word[0]->data) == 0)
   { 
    find = temp;
    break;
   }   
   else
     {printf("ang");
    find = temp;
    temp = temp->rightchild;
   }
  }
  
  leaf->NUMBER = 1;
  leaf->word[0] = word1;
  leaf->parent = find;
  leaf->leftchild = leaf->rightchild = NULL;
  
  if (strcmp(word1->data, find->word[0]->data) < 0)
  {
   find->leftchild = leaf;
  }
  else if(strcmp(word1->data, find->word[0]->data) == 0)
  {
   find->word[find->NUMBER] = word1;
   find->NUMBER++;
  }
  else
  {
   find->rightchild = leaf;
  }
 }
 }}

지금 word[0]->data안에 든 str값에 따라 왼쪽 오른쪽으로 이동하면서
트리 끝에 추가가 되야 되는데 계속 wordtree의 root에만 값이 저장 되네 ㅠㅠ
함수에 문제가 있는건가???