Used StringBuilder in while loop