An iterative method for optimal control of bilateral free boundaries problem