Help with printf in shell scripting

Hi all I am using printf in my shell script to format my output.I am using the following code.

printf "|\tIP Address\t|\tModel Number\t|\tDOM/HW\t|\tSoftware Version\t|\n"		  
  
  printf "|\t%s\t|\t%s\t\t|\t%s\t|\t%s-%s\t\n" $encoder $modelno $type $sv1 $sv2 

  printf "|\tFPGA DATECODE\t|\tAX VERSION\t|\tUP TIME\t\n"

  printf "|\t%s\t|\t%s\t|\t%s days %s hours\t|\n" $fpgacode $axversion $edate1 $etime1

I need a output to be like following

|       IP Address      |       Model Number    |       DOM/HW  |       Software Version        |
|       10.77.168.58    |       SE-6601         |       DOM     |       0.0-0.120530_1325_RockMan8_root
|       FPGA DATECODE   |       AX VERSION      |       UP TIME
|       10251431        |       0x61210F0F      |       21 days 0 hours |

I give the IP address as command line argument and print the data.

When I give two IP address as input the output is messed up as follows:

|       04181458        |       0x61000035      |       20 days 1 hours |
|       10.77.168.54    |       SE-6601         |       DOM     |       4.1-2
|       10.77.168.58    |       SE-6601         |       DOM     |       0.0-0.120530_1325_RockMan8_root
|       10251431        |       0x61210F0F      |       21 days 0 hours |
|       FPGA DATECODE   |       AX VERSION      |       UP TIME
|       FPGA DATECODE   |       AX VERSION      |       UP TIME
|       IP Address      |       Model Number    |       DOM/HW  |       Software Version        |
|       IP Address      |       Model Number    |       DOM/HW  |       Software Version        |

I need the output to displayed neatly.

I feel the newline in the printf statement is executed before the variables are substituted.

Am I doing anything wrong?

Please suggest.Thanks.

I can't tell why it's doing that without seeing more of your code.

... further to Corona688 ... and examples of the command line used to invoke the script with one IP address and two IP addresses.

The problem is more likely in the loop construct than in the printf statements.