Hello Satwik,
Please go through below links,
Work center hierarchy - PP - Work Centers - SAP Library
You mention you have 9 departments and every department has different number of machines, are the machines of the same type ? If yes, then you can have a hierarchy created for 9 departments ex: Department 1, Department 2.. Department 9 and group work centers in every department under the respective hierarchy.
The use of work center hierarchies is mainly for capacity planning. Hope you can go through the links and design a hierarchy suitable for your organization.
Best Regards,
Ameya Beri