You'll find it easier to construct the parse tree in the parser, and print it top-down recursively once the parse is finished. That has several advantages: first, you're not restricted to parse trees, and can instead produce an abstract syntax tree, which is generally a lot clearer. Second, you can produce the tree in any form you like.
I was going to insert a proof that it's not possible to draw a parse tree while you're doing a left-to-right parse, but rather to my surprise, I convinced myself that it is possible provided you loosen the rules a bit: you have to be able to move the cursor up and down and left and right, but you can do it without every overprinting anything. To do that, you must draw the tree with the leaves (terminals) either on the left-hand margin or at the top, and you can then draw the reductions by drawing lines from each child, and remembering what the "connection point" of the resulting node is. I don't know if this is a suitable programming exercise for someone just starting with parsing, but it is possible, even with a console application.
Here's an example of a "reverse pstree" graph:
(41*x) + (27/y) - sin(2*pi*z);
(───────────────────────┐
41─factor─term┐ │
*─────────────┤ │
x─factor──────┴term─expr┤
)───────────────────────┴factor─term─expr┐
+────────────────────────────────────────┤
(───────────────────────┐ │
27─factor─term┐ │ │
/─────────────┤ │ │
y─factor──────┴term─expr┤ │
)───────────────────────┴factor─term─────┴expr┐
-─────────────────────────────────────────────┤
sin─────────────────────────┐ │
(───────────────────────────┤ │
2─factor─term┐ │ │
*────────────┤ │ │
pi─factor────┴term┐ │ │
*─────────────────┤ │ │
z─factor──────────┴term─expr┤ │
)───────────────────────────┴factor─term──────┴expr
The algorithm used to produce that keeps the width and height of every stack item; terminals start with a height of 1 and a width of the terminal itself. In each reduction rule:
the cursor is moved to the right until it is to the right of every child;
the cursor is moved up to the bottom of the first child
for each child, a horizontal line is drawn from its bottom right corner to the column where the cursor is, and then a vertical line is drawn until the next child's row is reached. At the last child, the reduction's non-terminal name is printed, and the height and width of the resulting non-terminal are recorded.