Melt margarine in a small heavy saucepan over medium heat; add flour, and stir until smooth. Cook, stirring constantly with a wire whisk, 1 minute. Gradually add milk, stirring constantly until white sauce is thickened and bubbly. Remove from heat; stir in salt. Set aside.
Coat a 7- x 5 1/4- x 1 1/2-inch baking dish with cooking spray. Arrange half of endive slices in bottom of dish. Arrange half of potato slices over endive; sprinkle with half of shallot and 1 tablespoon cheese. Top with half of white sauce. Repeat layers, ending with remaining white sauce and remaining 1 tablespoon cheese. Bake, uncovered, at 350° for 45 minutes or until potato is tender.