リスト構造が環状になっていて扱いにくいので、先頭と末尾はNULLにしました。

/* リストに新しい要素を挿入する */
LIST *InsertItem(LIST *lp, int x)
{
LIST *lpnew, *lptemp, *lptemp2;

/* 新しいリスト要素を生成する */
lpnew = (LIST *)malloc(sizeof *lpnew);
if (lpnew == NULL) {
/* stderrにエラー文字列を出力する */
fprintf(stderr, "メモリーエラー\n");
/* exit()関数を使って実行を終了する */
exit(1);
}
/* 新しい要素に値を代入する */
lpnew->data = x;

/* 初回のケース */
if (lp == NULL) {
lpnew->prev = lpnew->next = NULL;
/* 新しい先頭を返す */
return lpnew;
}

lptemp = lp;
/* 挿入位置を求めてリストを前進する */
while (lptemp && lptemp->data < x) {
lptemp2 = lptemp;
lptemp = lptemp->next;
}