Why “sudo vim /etc/my.cnf” file is empty?
.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.