Could you clarify why 3HCl(g) and 3HF(g) does not effect the delta H in the final equation?
The 3HCl(g) and 3HF(g) are part of the 2nd and 1st equation respectively. I guess you meant to ask why we did the calculations only based to SmF3(s) and SmCl3(s), and we didn't mention anything about 3HCl(g) and 3HF(g) ?
Well, in order to get the desired equation, we needed to put the SmF3(s) and SmCl3(s) of the separate equations into the correct place, and with the correct factors (by reversing/ dividing).
By doing that, we expected that all the other members of the equations (like the 3HCl(g) and 3HF(g)) would be also modified correctly so that they would give the desired result when adding the equations.
Is it certain that HCl(g) and HF(g) (and all other members) will be modified correctly to give the desired result? No, but if adding the equations doesn't give the desired result after these modifications, it would mean that the exercise cannot be solved. That is because, we already did the needed modifications for SmF3(s) and SmCl3(s), so any further modification would alter these members and the final equation would still be incorrect.
So, as I said earlier, you just focus your attention to one member per equation (in our case SmF3 (s) for the 1st and SmCl3 (s) for the 2nd) and, when finishing the modifications, you just expect that the result will be the final equation.
So, in our case, we choose SmF3 (s) SmCl3 (s). Could we make the divisions/reverses based to another member instead? Yes, we could also use other members, as long as these members are not present at the other equation. Based on that, we could not use 2Sm(s) or 3H2(g) for our calculations since they are present to both the equations (even if it was possible, it would make the calculations very complicated). But we could use 3HCl(g) and 3HF(g) with the same way we used SmF3 (s) SmCl3 (s).