Output of the Code

Mam im able to understand the concept of Tower of hanoi but i cant understand that how this printing of steps take place can u please exaplain me that how that steps is printing one by one?

Solution:
Move Disk 1 from peg A to peg C. Then move disk 2 from peg A to peg B and, finally, move disk 1 from peg C to peg B.
Here peg A is the source, peg B is the destination and peg C is the spare peg.

For a given N number of disks, the way to accomplish the task in a minimum number of steps is:

Move the top N−1 disks to a spare peg.
Move the bottom disk to the destination peg.
Finally, move the N−1 disks from the spare peg to the destination peg.
Example with 5 disks:
We need to move 5 disks from peg A to peg B.

Steps:

Move the top 4 disks from peg A (source) to peg C (spare), using peg B (dest) as a spare peg, by recursively using the same procedure. After finishing this, we’ll have all the disks except the last disk on peg C.

Now, with all the smaller disks on the spare peg, we can move the largest disk from peg A (source) to peg B (dest).

Finally, we want all the disk moved from peg C (spare) to peg B (dest). We do this recursively using the same procedure again.

Code:

TOH(disk, source, dest, helper):
IF disk == 0, THEN:
   move disk from source to dest
ELSE:
TOH(disk - 1, source, helper, dest)   // Step 1 above
move disk from source to dest          // Step 2 above
TOH(disk - 1, helper, dest, source)   // Step 3 above

I totally understand the concept .My doubt is that how that printing of steps take place in the output

This is the tree for three disks:

Mam im getting confused can u please provide me the dryrun of code in terms of source destination and helper.Plz mam!