Take a medium-sized saucepan, add all-purpose flour, milk, and whisk for 5 minutes to make a smooth paste. Put it over a medium heat and cook till the mixture starts bubbling. Stir constantly and allow it to thicken for 10-15 minutes. Keep this aside and allow it to cool down. In a large bowl, add the butter, sugar, and vanilla.