Print node at k distance

how do you i have to take input the value ,from pre oder traversal
cant it be simple input

You can see this:

can you pls explain the code to me