Prepare and bake cake as directed on the package for a 9 x 13 inch pan. Cool completely.
Combine flour and milk in saucepan. Cook, stirring constantly, until thick. Cool completely. Cream 1 cup sugar, 1/2 cup margarine, and shortening. Add cooled milk mixture, and beat well. Spread over cake. Refrigerate.
In a small bowl, beat egg. Stir in vanilla, melted chocolate, hot water, confectioner's sugar, and 1/2 cup margarine. Pour over second layer. Refrigerate.