Why are the files not being created correctly?
When you save a file using the Save As button from the Arduino IDE, it saves the current file as a sketch i.e. as an .ino file.

To create a .cpp and .h files for working on a new library, you need to create the files alongside a sketch. For this, you can use the Tab button on the top right (circled in red).


  


Click on it, and select New Tab. You will get a bar at the bottom of the screen asking for a file name. Enter the name with extension (test.cpp) and press Enter.


  


Your file has now been added to the current directory.


  


Similarly, follow the same steps for creating the .h file.

Once your library is complete and ready to ship, you can move the .cpp and .h files to a separate directory and then add it under libraries.