Problem while using jQuery before() function for inserting an element before the last element.

Problem while using jQuery before() function for inserting an element before the last element.

Hi,
  I am trying to insert a div before the last element using before() function.For the first time it is working.When i try to add another one before the last element ,the first one is getting replaced with the second one,instead of
creating it below the first one.The thing is that i am creating the html content dynamically.


Pls provide any hint.

~Ragesh Kumar A.K