Can I install the class module and use it without buying the courses module
Yes, it can work with any group based module, such as Groups, Spaces, Events.
How can I do that. Can you explain
You can activate classes related blocks on main group view page, or there is classes functionality in Classes tab on view group page.