A low OG means less fermentable extract made it into the kettle than the recipe assumed — usually a mash or lauter efficiency problem, not a fermentation one, since this reading happens before yeast is ever involved. The fix is adding concentrated fermentable sugar, not water, and the amount is a real calculation rather than a guess.
The shortfall, in numbers
19 L reading 1.040 against a 1.050 target is short by 10 gravity points across the whole batch — worked in gravity-point-litres (points x litres, since points alone don't account for volume), that's (50 - 40) x 19 = 190 gravity-point-litres still needed. That number is what any fix has to supply, however you supply it.
Two ways to actually close the gap
Blend in a small volume of concentrated sugar solution. Using the site's blending tool with a strong DME solution (roughly 1.200 SG, a thick dissolved-extract mix) as "batch B" against your 1.040/19 L "batch A," hitting a 1.050 target needs roughly 1.27 L of that concentrated solution added, bringing the batch to about 20.27 L total. Run this with your own numbers — swap in the actual gravity of whatever concentrated solution you're adding (a strong late DME addition dissolved directly into the kettle, or an extract top-up) rather than assuming 1.200 is exactly right for your syrup or DME batch, since concentration varies with how much water you use to dissolve it.
Do the raw gravity-points math directly with dry malt extract. DME's commonly published extract potential is roughly 44 gravity points per pound per gallon dissolved into wort (John Palmer, How to Brew) — converting the 190 gravity-point-litres this batch needs into gravity-point-gallons (190 / 3.785 ≈ 50.2) and dividing by that 44 ppg figure gives roughly 1.1 lb (500 g) of DME dissolved directly into the kettle, stirred until fully in solution, then re-measured to confirm before moving on.
Why this happened, so it doesn't happen next time
A low OG almost always traces back to one of: mash efficiency lower than the recipe assumed (a coarser crush, a shorter mash, a channeled sparge that didn't rinse the grain bed evenly), more pre-boil or sparge water than planned diluting the same amount of extracted sugar across a larger volume, or a longer boil than intended that should have concentrated things but didn't fully compensate for an efficiency shortfall underneath it. Checking your actual mash efficiency against what your recipe software assumed — most all-grain setups land somewhere 65-78% depending on equipment — is worth doing once you're not mid-brew-day and under time pressure.
If it's the opposite problem
A wort that came in above target, rather than below it, is the far more common of the two and has its own dedicated page: see how to dilute a too-strong wort for adding water back down to target instead.