From a Waveform to a .wav file
In MATLAB you can create a .wav file waveFileName.wav from a waveform y with sampling frequency Fs using MATLAB's audiowrite as follows:
filename = 'waveFileName.wav';
audiowrite(filename,y,Fs);

You can also read and output a waveform y and its sampling frequency Fs from the .wav file waveFileName.wav using MATLAB's audioread as follows.
[y,Fs] = audioread('waveFileName.wav');

I am sure there must be corresponding functions in Python.