You need the correct tools and fixings for this job. First drill into the masonry with a masonry bit. Use a wood bit for drilling through the wood. Insert an appropriate screw through the wood and into the masonry pilot hole. You may need rawl plug to ensure a tight fit.