Do you mean predecessors or ancestors? Predecessors are nodes whose ID is less than the current node's. Ancestors are nodes who are parents, grandparents, great-grandparents etc. of the node. You code appears to print ancestors.
Although it might work, your code is not efficient because it doesn't use the structure of the tree to help find the node you're looking for. For example, if ID > node->ID then there's no point in searching the left branch because you know that all those nodes are too small.