Are you sure you are using the correct procedure?
Here is the simplest way I know of. Grab an icon (shortcut to a program) on the desktop:
Drag it to the taskbar and release it there:
That will result in a desktop icon and a pinned icon:
Right-click the desktop icon and click "delete":
That will leave you with only the pinned icon on the task bar:
Note: when you unpin the taskbar icon it will not
restore the desktop icon.