I'm so sorry to read about your loss. After trying for so long that must have made it that much harder to deal with
I had both hsg and a saline sonogram. HSG checks for tube abnormalities using radiographic dye, while a saline sonogram detects abnormalities in the uterus using simple saline (fibroids, polyps, cysts, shape/size/tilt abnormalities). A saline sonogram cannot tell you if your tubes are scarred, clear, gunked up or blocked entirely. You need the hsg to determine that (or an SHG which isn't as common, at least not where I'm from since the HSG gives such clear and accurate results).
At the time I had my hsg I had two children from a previous marriage who were conceived with no trouble. My husband and I had been trying for awhile and that threw up red flags for me. My first two were literally the same ages as yours are now, and my doctor recommended the test to make sure nothing had changed in all that time. It was considered necessary to attempt our first IUI, and I learned then even silent infections can impact tube health, so it seemed logical to move forward. It ended up being far less painful than I anticipated and I'd go so far is to call it only mildly uncomfortable. Placing the catheter and inflating the balloon was the toughest part but it lasted maybe 30 seconds. My tubes were found to be "sludgy" and when asked if I'd like to try clearing them with a flush of the dye right then and there I said go for it. It didn't hurt and was successful. At about that same time our second sperm analysis results came back and were able to nail down male factor as the culprit of our struggles.
The saline sonogram was only performed as a preliminary test by our RE before our subsequent IVF attempt. It was part of the dry run test to determine how long equipment needed to be, shape and size of my uterus, where exactly he thought it best to position transfer and to make sure we didn't have any adhesions, polyps or fibroids that might stand in our way.
I think the hsg is a great next step