Thanks @jhon.c

This code is working, one change I made to the encrypt command to use sha256 digest.

openssl aes-256-cbc -in plaintext_file.txt -out encrypted_file.enc -md sha256 -pass pass:111111

without this it used to give some error as below

140023352215472:error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt:evp_enc.c:618:
Error finalizing decryption: No such file or directory
Error decrypting file.