Why “sudo vim /etc/my.cnf” file is empty? I want to edit some of InnoDB variables ,I go to the .my.cnf which is located in home/.my.cnf I found the file just empty. And when I check SHOW VARIABLES in MySQL it gives me all the variables and their values. Why the file is empty and how can I edit the needed variables ?
.my.cnf in your home directory is only read by the mysql clients, so this is not where you should set system variables for the mysql server. .my.cnf can be used e.g. for your credentials so that you can log in without having to type the username and password every time.

The system variables for the server as well as system wide for all users can be configured in /etc/my.cnf and files included by that file. If you want to edit this or change any system variables, make sure to set the variables in the correct section of the file. See the documentation on option files for more details and examples. 

SHOW VARIABLES; will show all system variables and their values - this includes variables you haven't explicitly set in your .cnf files as it will also show variables that just have default values.