Its just trim molding, to hide the cut edge of the soffit where it abuts the wall.
It should be re-attached for both appearance and critter protection. You can add some foam insulation, which will help seal the edge.
A bead of exterior caulk, then the molding, then another bead if there are any gaps in the molding-to-wall or molding-to-soffit,
Use 1" to 1 1/2" hot-dipped galvanized 4d finishing nails and try to hit structure underneath. If you are a tool hound, this would be a good time to get a small air compressor and an 18 ga finish nailer. Tell your wife you can inflate her tires and the kids basketballs/footballs. I've expanded from 18ga nailer to 15 ga nailer, crown stapler, 16d framing nailer and strip flooring nailer, all with the same pancake compressor.
Your flashing will need to be fastened in place with something. I made 3 sketches the illustrate hopefully on of the ways to reset your flashing back in place.
The first of three labeled, "Not good" ids the least desirable way to set flashing to a wall but it is done everywhere. It is simply a piece of metal liad to the wall and held in place with masonry nails and caulked. Hot and cold weather will make the caulk fail when the metal buckles between nails.
The second is "good", the flashing is turned into a deep cut mortar joint (about 1")and nails are placed so the head of the nail laps over the bend edge (about 3/4") to hold the flashing in place. With the rigidity created by the bent corner and the nail not penetrating the flashing, the metal can move more freely when the temps change. In both cases mentioned already I have seen nails rust or fall out or both, in time.
The third, to me is the best, it has its down side but there are no nails to rust. I have seen this on old roofs I helped redo and was impressed how well it worked, using wood shims. It is the same procedure as the second sketch but no nails are used. The technique is, 2 cedar shims are used, in each spot, cut to allow the whole shim to fit in the joint with the metal. They are laid one on top of the other, points together, and driven so they snug in place as they slide by each other with in the joint. Needless to say the shims need to be cut to 3/4" wide to fit behind the surface of the brick or drive wider ones in then cut off the excess an caulk the joint, covering the shim, actually that is much simpler.
The caulk to use is made by many manufacturers, OSI, Geocel, Locktite and others, all have a caulk that is rated to do what you need. The big box stores will have them on hand, or even your local small hardware stores will carry the line of caulk you need. It is just roofing caulk, see that it has a warranty long enough to last the lifetime of your roof.![enter image description here](https://i.stack.imgur.com/0jnyF.png)
Best Answer
As far as I know there is no "easy" method that works. You have to strip the bricks down to that level and replace the flashing. Of course, this makes it an excellent time to consider how much you are or are not in love with brick veneer, since that's removing most of it. If you use a more durable flashing (lead is nice) you might get more than 60 years out of it; of course, if you can get 60 years out of anything it's probably more than you personally need.
You might find considerable cost-benefit in a rigid-foam / stucco replacement for the brick veneer - your walls are likley poorly insulated circa 1950s, and that would add a great deal of insulation to them.