I got it working with the below script,
#!/bin/sh
filename="binaryfile.bin"
contentLength=$(wc -c < binaryfile.bin)
echo "Content-type: application/octet-stream"
echo "Content-Length: $contentLength"
echo "Content-Transfer-Encoding: binary"
echo "Content-Disposition: attachment; filename=$filename"
echo ""
cat binaryfile.bin