You can use online templates for wills in some cases, but you should do so only from trusted sources and at your own risk.
To reduce the risk that your will is contested in court or creates probate costs for your heirs, you should consider hiring an estate planning attorney to draft the will for you.
Do I Need Professional Help to Prepare a Will?
How Much Does it Cost to Prepare a Will?