The invitation letter is written to the local visa officer.
State the situation: For example, you are so-and-so, what is your passport number, what visa (or PR) do you currently hold, where do you live, and have a stable income (proof of income is attached separately). I would like to invite XX to come to the United States for XX in a few years or months. Sign and sign below.
The most important thing is that you must be able to prove that you have the financial ability to provide your XX with all food and accommodation in the United States. That is to say, you need to provide your financial income and financial ability, as well as proof of housing.
How to write the invitation letter is not so strict. The main thing is to prove that you have the ability to ensure that your accommodation, food and daily life will be fine after XX comes.
In addition, you need to provide proof of relationship between you and your XX. It's just a notarial certificate. Prove who you are.