The Balrog, Flame of Udûn will be put on the bottom of its owner's library only if it's still on the battlefield when the ability resolves. If it leaves the battlefield before that point, it will stay in whatever zone it's in, even if it's returned to the battlefield before the ability resolves.