Print elements of a linked list in forward and reverse order using recursion