How to save a model or pipeline?

Suppose I have created a machine-learning model or pipeline that works according to need perfectly. Next time, to use my time efficiently, I want to use a pipeline that I created earlier but before using it I have to save that pipeline. I have learned that we can store pipelines using Sklearn. I tried to save it, but my code didn’t give me a successful result. Here, it is below:
Sample code to create a pipeline:

Saving a pipeline:
import pickle
# Save the model to a file
with open('model.pkl', 'wb') as f:
    pickle.dum(pipeline, f)
# Load the model from the file
with open('model.pkl', 'rb') as f:
    pipeline = pickle.load(f)
    X_testpred = np.random.rand(5)
    y_testpred = pipeline.predict([X_testpred])
    print("Predicted value:",y_testpred)

AttributeError: module 'pickle' has no attribute 'dum'

Can someone correct my code and provide me with efficient alternative codes that help me in achieving my goal?