When I open smart object, work on it, then saved it, it does not update the file in the original layout…
No; it's not supposed to. The files are not linked.
The Smart Object is a copy of the original image that is embedded in the new file. It is not linked to the other file from where the Smart Object originated.
Are you clicking on "Save As" or "Save" after editing your Smart Object ?
That is normal, expected behavior, not a "problem", and you cannot "fix" it.
When I open smart object, work on it, then saved it, it does not update the file in the original layout, instead, it ask me to save it in temporary folder. How to fix that problem so when I save the smart object, it update the file and not save it somewhere else.
One reason could be that the format of the file that was embedded in the SO does not support some aspect of the edits that you've made.
For example, say the SO contained a JPEG. When you open the SO, Photoshop creates a temporary copy of the JPEG and opens it into a document window. Now you add a layer, say a Curves Adjustment Layer. JPEG does not support layers, therefore, when you try to Save, the Save As dialog will open at the file's folder (TemporaryItems) and await your instruction, instead of a save being silently performed.
Now for solutions...
You could ensure the edited SO doc is suitable for saving to its current file format, for example, flatten it if the format is JPEG (but that may incur unacceptable loss of quality due to compounded lossy JPEG compression), then a Save will silently complete.
A slightly more complicated solution but one which will preserve all features and quality of the edited SO document is to Save As to a PSD, PSB or TIFF then, in the parent document, right-click the SO's name in Layers panel, pick Replace Contents and choose the newly saved file.