Your dick isn't really getting bigger when you lose weight. What's happening is that you are losing fat around your pubic area which results in more of your dick showing. Consequently, it gives the appearance that your dick has grown.
Now that you know your dick isn't going to get any bigger, don't let that discourage you. If anything, the weight you lose will have other ancillary benefits: longer stamina, better erections, greater self-esteem, etc.