1)Learn virus and malware analysis and reverse engineering.
2)Learn a programming language.
3)Learn a scripting language.
4)If your antivirus is for windows learn "Windows Internals"(Linux is open source!You can get source code of it easily!!!)
5)Learn how to manage a database.(Develop your own DBMS)
6)Learn binary searching algorithms to effcient scanning. After finishing above you can be able to develop a file scanner.