I know this may seem unhelpful, but your question is too vague. If I were creating a plugin type that I had not work on previously I would find one that did something similar and then read through the code. You need to make a start and ask specific questions.
The more information you gather the better chance there is of giving you useful answer. For example, what happened when you ran it?, do you have a background in programming, what do you mean by categories, what is the overall purpose of your plugin. The people in these forums are keen to help but we need something to work with.
i wanna create plugin for Quiz and give it weight finally create quizs randomly from all quiezs
Now that is useful information. I have recently been thinking myself of how it would be possible to calculate the weight of quiz questions across quizzes and I don't have any simple answers. For example should the weight be based on characteristics of users. So if you were teaching English would you want to know what the chance was of getting a question correct if you had 1,2 or 4 years of English, the age of the taker, the first language of the taker. Or would you just want to know how many people get the question correct or incorrect. If you do that some questions would rarely get a correct response simply because the question itself was faulty. But here I am guessing at what you might want. You need to explain in detail what you actually want.
I suggest you take a look at the code for adaptivequiz
Adaptive quiz is not currently maintained and is not up to date, but it does include a mechanism for giving weight to quiz questions through the tags system. StudentQuiz is very actively maintained and amongst its many impressive features has a system for automatically calculating the weight/difficulty of a quiz question.
Note that the quiz and question types is one of the more complex areas of Moodle because it is the most powerful quizzing system in history, and therefore is not simple. This is to contrast it with something like text filter plugins which can be quite straightforward.