I am trying to migrate from SQL SERVER 2012 to 2014 and found out I cannot use .bak files because of different versions. I know how to create a .sql back up file using the SSMS but I can't find a solution using a script or sqlcmd.
Why can't you use SSMS?
Exporting to .sql file has been discussed in How to backup Sql Server to sql file?
Did you consider Linked Servers? You can use 3 and 4 part names to access data from one server to another, for details see How can I connect to an external database from a sql statement or a stored procedure?. Another alternative to access data is trough OPENROWSET, that is also discussed above.