How can I develop multiple widgets for a WordPress theme?

When registering a sidebar, you can use certain placeholders for the widget classes. Here’s an example taken from the codex:

'before_widget' => '<li id="%1$s" class="widget %2$s">',

It’s the lack of %1$s and %2$s that is causing your issues. When in doubt always read the documentation on the codex and the developer hub/handbooks