1. Please indent your code properly, its almost unreadable.
2. The while loop that starts on line 49 ends at line 62, so if there are 3 rows in the database, you'll get 6 outputs (because the iterator will run with each row in the database)
3. You are only displaying the value of variable in the while loop which you never set so you'll get 0 as output. If you want the values of billMonthYear and principal, then you can change the code in the second while loop to