I am trying to make a Classifier using Machine learning to detect malwares,am I headed in the right direction?
It is not clear in your post whether or not you are using training/test sets so I will answer in this way:

The first thing to do if you want to validate your results is to cut your set into a training set and a validation set. This way you train the K-NN method on your training set, and you use the trained classifier on the validation set. Then you can monitor the validation error, and the training error. 

In the best case scenario, it should look like this : 

The aim is to obtain a model that generalizes well, which means being able to accurately predict the class a sample belongs to, when it has never seen the sample before.