If you look through your type error, it’s actually because you’re trying to use the + operator on a PosixPath type and a str. You’ll need to convert the PosixPath to a string before you can use the imwrite.
Maybe try:
cv2.imwrite(str(path) + "https://stackoverflow.com/" + "photo.png", img)
Alternatively, use the proper concatenation as described in the pathlib docs.