Here are the instructions: Share the internet connection on Mac with other network users - Apple Support
Please note that if your computer is connected to the Internet using WiFi, the other devices need to connect to your computer using other than WiFi. If your computer is connected to the Internet using Ethernet, then your other devices can share that Ethernet connection using WiFi to connect to your computer.
If your computer has a WiFi connection to the Internet, why not just connect to the same WiFi signal with your other devices rather than trying to use the computer's connection?